Wrapper Classes

9. Program

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

class M9 { public static void main(String[] args) { String s1 = "abc"; Character c1 = new Character(s1); char c2 = c1.charValue(); System.out.println("done"); } }

10. Program

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

class M10 { public static void main(String[] args) { int i = 10; String s1 = "20"; Integer obj1 = Integer.valueOf(i); Integer obj2 = Integer.valueOf(s1); int m = obj1.intValue(); int n = obj2.intValue(); System.out.println("done"); } }

11. Program

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

class M11 { public static void main(String[] args) { double d1 = 45.987; String s1 = "67.9898"; Double d2 = Double.valueOf(d1); Double d3 = Double.valueOf(s1); double d4 = d2.doubleValue(); double d5 = d3.doubleValue(); System.out.println("done"); } }

12. Program

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

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

Page....