previous |
start |
next
The null Reference
- null reference refers to no object at all
- Can be used in tests:
if (account == null) . . .
- Use ==, not equals, to test for
null
- showInputDialog returns null if the user hit
the cancel button:
String input = JOptionPane.showInputDialog("...");
if (input != null) { ... }
- null is not the same as the empty string
""
previous |
start |
next