Multiple choice

What is the output of the above program?

public class Sss
{
public static
void main(String args[])
 {
 byte a=127; a++;
 System.out.println(a);
 }
}

  1. 127

  2. 0

  3. 128

    • 128
  4. Compilation error

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

Byte ranges from -128 to 127. So, when we increment after 127, it will give -128.