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
Post a Comment