I am just trying to see if I can access static variable through a ´static´ method using a ´reference variable´ that is initialized to ´null´ (I know this is not recommended). But I can't seem to be able to access the method at all. Can't seem to spot what is wrong.
class Emp {
static int bank_vault;
static int getBankVaultValue(){
return bank_vault;
}
}
public class Office {
public static void main(String[] args)
{
Emp emp = null;
System.out.println(emp.); // Here I don't get getBankVaultValue method option
}
}
NullPointerException.