Question discussion

What is the output of the following Java code? public class Test { static int x = 5; public static void main(String[] args) { int x = 10; S…

556Medium DSSSB TGT Computer Science 0 replies 1 views
0
What is the output of the following Java code? public class Test { static int x = 5; public static void main(String[] args) { int x = 10; System.out.println(x + Test.x); } }
  • A10
  • B15
  • C20
  • DCompilation error
Correct answer: B

Discussion 0

Nobody has replied yet. Start the discussion!