-4

This site: Information on the null constant in Java states that the following two statements are synonymous:

if(PossibleNullVariable!=null)PossibleNullVariable.Action();
PossibleNullVariable!.Action();

Also, This site: Information on avoiding null checks in Java states that these two statements are synonymous:

String str = getStringMayBeNull()!=null?getStringMayBeNull():"";
String str = getStringMayBeNull() ?: “”;

Could I please get some clarification please? Thank you for your time. (:

MeBigFatGuy
  • 28,272
  • 7
  • 61
  • 66

1 Answers1

1

Both of those are suggestions given by the authors of the articles as better ways of dealing with null. Neither are currently in Java.

Rodney Gitzel
  • 2,652
  • 16
  • 23
  • Thanks, I guess I didn't notice that when reading. Makes sense that I couldn't find any other documentation of the subject. – KiwiStrongis Dec 05 '11 at 05:33