Multiple choice technology programming languages

What is the output of the following code when compiled and run? Select two correct answers. public class Question01 { public static void main(String[] args){ int y=0; //line 1 int x=z=1; //line 2 System.out.println(y+","+x+","+z); //line 3 } }

  1. Prints 0,1,1

  2. Error during compilation at line 1

  3. E. Error during compilation at line 2

  4. Error during compilation at line 3

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

Line 2 is invalid because 'z' has not been declared. In Java, you cannot chain assignments like 'int x = z = 1' if 'z' isn't already defined. This causes a compilation error at line 2, and subsequently line 3 fails because 'x' and 'z' are undefined.