Multiple choice general knowledge history

  1. public class Question { Public static void main(String args[]) { int i=10; System.out.println("i="+++i); }

  1. i=0

  2. i=11

  3. Invalid argument to operation

  4. None

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

The statement 'System.out.println("i="+++i);' contains a syntax error. The '++' is the pre-increment operator, but the expression '+++i' (which could be parsed as '++ + +i' or similar) is invalid Java syntax. In Java, you cannot have three plus signs in a row like this - it's ambiguous and the compiler will reject it.