| preferred AP College board partner for AP classes
AP Computer Science A/Unit 2: Using Objects
Start Practice Test
Share
medium Solved by 15 students
Java Integer Overflow
< Prev
Next >

Develop code to cast primitive values to different primitive types in arithmetic expressions and determine the value that is produced as a result.
What is printed as a result of executing this code segment?

int max = Integer.MAX_VALUE;
int result = max + 1;
System.out.println(result);
A

2147483648

B

An ArithmeticException is thrown

C

-2147483648

D

2147483647

Hint
Did You Know?
Explain Why
Explain All Answers
Check Answer
Show Correct Answer

Question Leaderboard

Rank
User
Correct Count
Attempt Count
Time
Score
#1jeonsaw172322 0m 35s 165
#2thuyjerry11 0m 00s 100
#3kaisuki14 0m 00s 70
#4sailajavadlamani3314 0m 00s 70
#5sgarv251314 0m 00s 70
#629AmeliaC11 0m 30s 70
#7patrickmeijer00914 0m 50s 20
#8richa.tuli11 1m 50s -10
#9psak1226 4m 53s -133
#10y.seong202713 5m 02s -222
APFIVE © 2020.
Email: [email protected]|Privacy Policy