title: I have a problem with the following Java code
body: <pre><code>public class b {
      public static void main(String[] args) {
          byte b = 1;
          long l = 127;
      //  b = b + l;            // 1 if I try this then it does not compile
          b += l;               // 2 if I try this then it does     compile
          System.out.println(b);  
      }
  }
  </code></pre>
  
  <p>I am using this code but I have problem: 
  I don't understand why <code>b=b+l;</code> is not compiling but if I write <code>b+=l;</code> then it compiles and runs.</p>
  
  <p>Please explain why this happens.</p>