This is a draft cheat sheet. It is a work in progress and is not finished yet.
What's null?
null is default value for java object. |
it is not a valid object instance |
simply a value says ref variable not referring to an object currently. |
thread ->stack->frame(method) ->variable(identifier,symbolic name) on frame |
null is just a value in the stack frame and no allocated memory on heap. |
Java syntax for null
not to primitive |
NullPointException when access instance member, ok to access static members |
throw null will cause NullPointException |
printed as null |
object array default value is null |
Dead code rule
Dead code only applies when compile-time constants are used |
While Loops |
will not compile if a false constant is used |
for loop |
will not compile if a false constant is used |
if conditional |
will compile regardless of constant, but a warning will appear for dead code |
Switch statement |
same as conditional but no warning |
try/catch |
catch block parameter order must go up in hierarchy order |
|
|
|
|
|