Guest User

Untitled

a guest
Sep 14th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. Best practice for Null check in Java
  2. if(test ! = null)
  3.  
  4. if(null != test)
  5.  
  6. // no compiler complaint at all for C/C++
  7. // while in Java, this is illegal.
  8. if(a = 2) {
  9. }
  10. // this is illegal in C/C++
  11. // and thus become best practice, from C/C++ which is not applicable to Java at all.
  12. if(2 = a) {
  13. }
  14.  
  15. if("bla".equals(test))
  16.  
  17. if(test.equals("bla"))
Add Comment
Please, Sign In to add comment