c++ null pointer exception code example

Example 1: What’s null pointer exception?

First, null keyword it does not refers to any object at all. 
Null keyword means no object.
null pointer excep: there is no object at all.
So you can't get access to the instance of that object

Example 2: null pointer exception

NullPointerExceptions are exceptions that occur when you try to 
use a reference that points to no location in memory (null)
 as though it were referencing an object.

Tags:

Java Example