title: Need explanation of casting in Java. Which way is the best?
body: <p>I have the following code: </p>
  
  <pre><code>double d = 23d;
  byte b = 52;
  
  int result;
  </code></pre>
  
  <p>I am trying to store the result of <code>d + b</code> in <code>result</code> and I have to cast in order to do that, however I have found two ways to do that and I don't know what the difference is. </p>
  
  <pre><code>//First method
  result = (int) d + b;
  
  //Second Method
  result = (int) (d+b);
  </code></pre>
  
  <p>What is the difference? </p>
  
  <p>Thanks</p>