I tried to execute the methods of a null object.and i write a program given bellow and in this program i failed to call the method:
{
public String getName()
{
return "Not Available";
}
public boolean isNull()
{
return true;
}
}
public class main {
public static void main (String [] args){
system.out.println(emp1.getname());
}
}
what is wrong in my code and how can I check if a object is null in java?