13. Program
//Find what it gives Compiletion Error / Compiletion Successfully / Output ?
class N { } class Manager14 { public static void main (String[] args) { N n1 = new N(); N n2 = new N(); N n3 = n1; System.out.println(n1==n2); System.out.println(n2==n3); System.out.println(n3==n1); } }
14. Program
//Find what it gives Compiletion Error / Compiletion Successfully / Output ?
class O { String s1; } class Manager15 { public static void main (String[] args) { O o1 = new O(); o1.s1 = "abc"; O o2 = new O(); o2.s1 = "abc"; O o3 = o2; System.out.println(o1==o2); System.out.println(o2==o3); System.out.println(o3==o1); } }
15. Program
//Find what it gives Compiletion Error / Compiletion Successfully / Output ?
class P { int i; P(int i) { this.i = i; } } class Manager16 { public static void main (String[] args) { P p1 = new P(100); P p2 = new P(100); P p3 = p1; System.out.println(p1 == p2); System.out.println(p2 == p3); System.out.println(p3 == p1); System.out.println(p1.i == p2.i); } }
16. Program
//Find what it gives Compiletion Error / Compiletion Successfully / Output ?
class Q { boolean b; } class Manager17 { public static void main (String[] args) { Q q1 = new Q(); q1.b = true; Q q2 = new Q(); q2.b = true; System.out.println(q1 == q2); System.out.println(q1.b == q2.b); double d1 = 10.3 , d2 = 10.3; System.out.println(d1 == d2); } }