A.A,B,C B.B,C,A C.Compilation fails D.The code runs with no output E.An exception is thrown at runtime
A.Compilation of class A fails. B.Line 28 prints the value 3 to System.out. C.Line 28 prints the value 1 to System.out. D.A runtime error occurs when line 25 executes. E.Compilation fails because of an error on line 28.
A.p.setWeight(420); B.p.changePayload(420); C.p = new Payload(420); D.Payload.setWeight(420); E.p = Payload.setWeight(420);
A.public int compareTo(Object o){/*more code here*/} B.public int compareTo(Score other){/*more code here*/} C.public int compare(Score s1,Score s2){/*more code here*/} D.public int compare(Object o1,Object o2){/*more code here*/}
A.static final int[] a = { 100,200 }; B.static final int[] a; static { a=new int[2]; a[0]=100; a[1]=200; } C.static final int[] a = new int[2]{ 100,200 }; D.static final int[] a; static void init() { a = new int[3]; a[0]=100; a[1]=200; }
A.return super.hashCode(); B.return name.hashCode() + age * 7; C.return name.hashCode() + comment.hashCode() / 2; D.return name.hashCode() + comment.hashCode() / 2 - age * 3;
A.p0 = p1; B.p1 = p2; C.p2 = p4; D.p2 = (ClassC)p1; E.p1 = (ClassB)p3; F.p2 = (ClassC)p4;
A.Line 35 will not compile. B.Line 36 will not compile. C.Line 37 will not compile. D.Line 38 will not compile.
A.Compilation fails. B.An exception is thrown at runtime. C.doStuff x = 6 main x = 6 D.doStuff x = 5 main x = 5 E.doStuff x = 5 main x = 6
A.2 B.24 C.234 D.246 E.2346