-4

When I tried to run this code in an online java compiler it says "possible lossy conversion from int to byte". But i can't understand the meaning of this message. Badly need help. I am a beginner at Java.

class HelloWorld{   
         public static void main(String args[]){
             byte b=9;
             b+=6;
             System.out.println(b);
             b=b+5;
             System.out.println(b);
         }
    }
Linkon
  • 1,058
  • 1
  • 12
  • 15

1 Answers1

1

When execute b + 5, b will be promoted to int, and the result will be int.

When you reassign this byte with this int, it might loss accuracy.

xingbin
  • 27,410
  • 9
  • 53
  • 103