java - String comparaison difference between two sentences -


please can tell me exactely difference between this

if(mystring.equals("test")) { } 

and

if("test".equals(mystring)) { } 

if mystring null, have

null.equals("test")   -->   nullpointerexception  "test".equals(null)   -->   false 

(if mystring != null expressions equivalent.)


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -