Originally posted by Lam Thai:
Hello Nachiket,
If you look at Sun's java API, you will find that Float has three constructors Float(double), Float(float), and Float(String). Meanwhile Integer has only two, namely Integer(int) and Integer(String). So I guess double literal does not go well with Integer, does it?
Regards,
Lam
Basically it the point of using the appropriate constructor.
So the following code works for Integer wrapper class:
So the narrowing conversion requires explicit cast .
Integer i=new Integer((int) 32D) ;
Correct me if wrong..
thanks