Question

What is the output of the following Java program? class Test {     static int x = 5;     static { x += 10; System.out.print(x+" "); }     public static void main(String[]
a) {         System.out.print(x+" ");         x++;         System.out.print(x);     }     static { x *= 2; } }

A 15 30 31
B 15 15 16
C 15 30 30
D 30 30 31
E 30 15 16
Practice Next

Hey! Ask a query