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

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>

Java Quiz
Start Quiz

or Read more about Java Quiz

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback