An identifier is the name of a variable, method, class, interface, or package. There are 4 rules for legal identifiers. What are they?
Does the following code compile?
public void test() {
var n = “hello”;
n = null;
var m = 1;
m = null;
}
It does not compile because the type for m is an int and a primitive int cannot be assigned null.
n = null compiles fine.