Multiple choice technology programming languages

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

  1. X=8

  2. X=10

  3. X=11

  4. None

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

Java interprets integer literals beginning with 0 as octal (base 8) numbers. The literal 010 represents octal 8, which equals decimal 8, hence the output is X=8.