A

Admin • 825.56K Points
Coach

Q. What will be output of following program?
public class Test{
public static void main(String[] args){
byte b=127;
b++;
b++;
System.out.println(b);
}
}

  • (A) 2
  • (B) 129
  • (C) -127
  • (D) -127 D. Compiler error
  • Correct Answer - Option(C)
  • Views: 11
  • Filed under category Java
  • Hashtags:

Explanation by: Admin
Range of byte data in java is -128 to 127. But byte data type in java is cyclic in nature.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.