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);
}
}
public class Test{
public static void main(String[] args){
byte b=127;
b++;
b++;
System.out.println(b);
}
}
β
Correct Answer: (C)
-127
Explanation: Range of byte data in java is -128 to 127. But byte data type in java is cyclic in nature.