I have a problem wit the following code of java

Posted by Sanjeev on Stack Overflow See other posts from Stack Overflow or by Sanjeev
Published on 2010-03-21T05:49:38Z Indexed on 2010/03/21 5:51 UTC
Read the original article Hit count: 358

Filed under:

public class b {

  public static void main(String[] args) {

        byte b = 1;

        long l = 127;

    //    b = b + l;              // 1  if I try this then its not compile

        b += l;               //  2 if I try this its compile

        System.out.println(b);  

  }

}

I don't understand why b=b+1; is not compile and if I write b+=l; then it compile an run.

© Stack Overflow or respective owner

Related posts about java