Wrapper Classes

5. Program

//Find what it gives Compiletion Error / Compiletion Successfully / Output ?

class M5 { public static void main(String[] args) { String s1 = "10"; Integer obj = new Integer(s1); int i = obj.intValue(); System.out.println("done"); } }

6. Program

//Find what it gives Compiletion Error / Compiletion Successfully / Output ?

class M6 { public static void main(String[] args) { String s1 = "9.989"; Double d1 = new Double(s1); double d2 = d1.doubleValue(); System.out.println(s1); System.out.println(d2); System.out.println("done"); } }

7. Program

//Find what it gives Compiletion Error / Compiletion Successfully / Output ?

class M7 { public static void main(String[] args) { String s1 = "10Z"; Byte b1 = new Byte(s1); byte b2 = b1.byteValue(); System.out.println("done"); } }

8. Program

//Find what it gives Compiletion Error / Compiletion Successfully / Output ?

class M8 { public static void main(String[] args) { String s1 = "true"; String s2 = "false"; String s3 = "abc"; Boolean b1 = new Boolean(s1); Boolean b2 = new Boolean(s2); Boolean b3 = new Boolean(s3); boolean b4 = b1.booleanValue(); boolean b5 = b2.booleanValue(); boolean b6 = b3.booleanValue(); System.out.println(b4); System.out.println(b5); System.out.println(b6); } }

Page....