Answer: Null literal is a null type which indicates that the reference is pointing to no object.
Example,
public class Employee
{
int name, id;
}
static void Main()
{
Employee emp = null;
..............;
}
In the above example, we have an
Employee class.
emp is an object created to
Employee.
But it is not referring to any object.
If we try to call the variables like,
emp.name;
emp.id;
will throws an error at the
runtime which is known as
Null Reference Exception.
Asked In: Spotted While Learning |
Alert Moderator