Validating string in Java
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/10983573/checking-for-null-what-order">Checking for null - what order?</a>  </p>
</blockquote>



<p>Can anyone please tell me what is the better approach in validating a string value for 'null' and why?</p>

<pre><code>String user = userService.getUserName(accID);

1) if(user != null) {
    ..
   }

2) if(null != user) {
    ..
   }
</code></pre>
