In java, local reference variables do not have a default value of null before they are initialized.
What exactly is the difference between a variable with a value of null, and a variable with no value?
In java, local reference variables do not have a default value of null before
Share
An uninitialized reference doesn’t have no value, it has an undefined value (and the compiler prevents you from using them, IIRC). A reference initialized to
nullwill result in a equality comparison withnullalways evaluating totrue.