InterviewSolution
Saved Bookmarks
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
class Test{static int a;static{a = 4;System.out.println ("inside static block\n");System.out.println ("a = " + a);}Test(){System.out.println ("\ninside constructor\n");a = 10;}public static void func(){a = a + 1;System.out.println ("a = " + a);}public static void main(String[] args){Test obj = new Test();obj.func();}}(A)inside static blocka = 4inside constructora = 11(B) Compiler Error(C) Run Time Error(D)inside static blocka = 4inside constructora = 5(E)inside static blocka = 10inside constructora = 11 |
| Answer» | |