Java NullPointException - How/when NullPointerException throws

-: Java.lang.NullPointerException :-

java.lang.NullPointerException is one the frequently getting exception in java. Most of the developer must have seen this exception while developing either java standalone application or web-based application.

1.      Hierarchy


Basically, exceptions occur at compile time and runtime. The NullPointerException is a runtime exception. Mainly this exception occurs when trying to do some operation on null where an object is required but it is null. Some of the common reasons for NullPointerException in Java programs are described below section.
2.       Common reasons for NullPointerException:
a.       Invoking a method on an object instance but an object is null at runtime.
b.       Access the variables of an object that is null at runtime.
c.       Throwing null in the java program.
d.       Accessing the index of an array which is null.
e.       Checking the length of the array that is null at runtime.

f.        When the method argument passed value.

........(to be continues)

Java Exceptions

Java Exceptions

 Exception in Java  are classified on the basis of  the exception handled by the java compiler. Java consists of the following type of built in exceptions:


Java Exceptions
Add caption



Package Name
Exceptions
Java.lang

Java.util

Java.util.concurrent

Java.util.prefs

Java.util.regex

Java.util.zip

Java.io

java.lang.annotation


java.lang.reflect

Java.net

Java.rmi

Java.rmi.activation

Java.rmi.server

Java.security

Java.security.cert

Java.sql

Java.text

Java.time
Java.time.format

Java.time.temporal

Javax.activation

Javax.activity

Javax.naming

Javax.naming.directory

Javax.transaction

Javax.xml.bind

Javax.xml.ws

Org.xml.sax







Java Exceptions

Java NullPointException - How/when NullPointerException throws

-: Java.lang.NullPointerException :- java.lang.NullPointerException is one the frequently getting exception in java. Most of the devel...