Easy Tutorial
For Competitive Exams

What is output of the following program:

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

-127
127
129
2
Explanation:
Range of byte data in java is -128 to 127 .
But byte data type in java is cyclic in nature
Share with Friends
Privacy Copyright Contact Us