Skip to content

Instantly share code, notes, and snippets.

@sidharthkuruvila
Created August 25, 2011 03:26
Show Gist options
  • Select an option

  • Save sidharthkuruvila/1169912 to your computer and use it in GitHub Desktop.

Select an option

Save sidharthkuruvila/1169912 to your computer and use it in GitHub Desktop.
Check for null before carrying out an operation
String a = canReturnNull();
String b = canReturnNull();
if(a == null || b == null){
System.out.println("I'm saying nothing");
} else {
System.out.println(a + b);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment