Variables and Data Types

AP Computer Science A· difficulty 4/5

int x = 100000;
int y = 100000;
System.out.println(x * y);

What is printed?

  • A

    10000000000

  • B

    1410065408

    check_circle
  • C

    Error

  • D

    0

Explanation

100000 * 100000 = 10,000,000,000 which exceeds Integer.MAX_VALUE; the result wraps around to 1410065408.

Want 10 more like this — adaptive to your weak spots?

Related questions