Question: Suppose that a variable a is declared as int a = 2147483647 (or equivalently, Integer.MAX_VALUE). What does each of the following print? a. System.out.println(a); b.
Suppose that a variable a is declared as int a = 2147483647 (or equivalently, Integer.MAX_VALUE). What does each of the following print?
a. System.out.println(a);
b. System.out.println(a+1);
c. System.out.println(2-a);
d. System.out.println(-2-a);
e. System.out.println(2*a);
f. System.out.println(4*a);
Explain each outcome.
Step by Step Solution
3.40 Rating (156 Votes )
There are 3 Steps involved in it
This question is about integer overflow and underflow In Java the integer type int is a 32bit signed ... View full answer
Get step-by-step solutions from verified subject matter experts
