Multiple choice general knowledge history

public class Question { public static void main(String args[]) { int x=y=10; y=12; System.out.print(x+"&"+y); } }

  1. 10 & 12

  2. 10 & 10

  3. Compile Time Error

  4. None

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

Java does not allow chained assignment in declarations like 'int x=y=10'. Each variable must be declared separately, or y must be declared first. The line 'int x=y=10;' is a compile-time error.