Multiple choice general knowledge history

public class Question { public static void main(String args[]) { int x=0x10; System.out.print("X="+x); } }

  1. X=10

  2. X=0

  3. X=16

  4. Compile Time Error

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

The prefix 0x indicates a hexadecimal literal in Java. The value 0x10 in hexadecimal equals 16 in decimal (1×16 + 0×1 = 16). Therefore, the output is X=16.