Float f1 = new Float("12.6f");
In this above code I didn't get any exception. But the below code I got
NumberFormatException
:
Long l1= new Long("200L");
I know all of the wrapper classes except Character provide two constructors
Integer i1 = new Integer(42); //Primitive
Integer i2 = new Integer("42"); // String
Float f1 = new Float(3.14f); //Primitive
Float f2 = new Float("3.14f"); // String
So why I get exception for this
Long l1= new Long("200L");
why this didn't
Float f2 = new Float("3.14f");