What happens as a result of an attempt to compile and execute the following code?
byte b1 = 127;
b1 += 1;
Explanation

127 is the maximum value for a byte variable. 128 is outside the range of byte values, but, due to number overflow, lowest possible negative number is returned, which is -128 for byte type>

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Keep exploring
Java quizzes
Cosmo
Sign Up Now
or Subscribe for future quizzes