Posted by: yellow October 13, 2008
Small java challenge
Login in to Rate this Post:     0       ?        
I am new to java myself, not Sure if it has templetes.

If it was C++ you can make one Templete instad of overloading function with variaty of parameters.
If you start writing functions ( or methods) the possible combinations of parameters can be quite high, and redundant.

I like the cast but then again the question asks for difference, ( which might get messed up because of loss of data). Hope someone can come up with solution.

P.S If its just int and double, there are only four Methods to be written, which should be a no brainier.
Read Full Discussion Thread for this article