Multiple choice general knowledge

What is the result of the following code? byte x = 23, y = 4; int z = 23 % 4; System.out.println(z);

  1. 3

  2. 4

  3. 4.75

  4. Compiler error declaration not allowed

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

The code calculates 23 % 4 (modulo operation). 23 divided by 4 is 5 with remainder 3, so 23 % 4 = 3. The variables x and y are declared as bytes but unused, and z is correctly declared as int to store the result.