What is NullPointerException in Java how to deal
|Top Tutorials||New Tutorials||Submit||Login||Register|
Total Hits: 8937
Total Votes: 89 votes
Category: JAVA/Core JAVA
Submitted on: 2012-09-22 08:32:16
Submitted By: Javin Paul
Description:Java.lang.NullPointerException comes when we try to access any field or method on Object which is null. Its come mainly due to programming mistake and breaking of contract between different part of application but there are few cases where you can avoid NullPointerException in Java by carefully coding like instead of object.equals("apple) you can call "apple".equals(object) which will not throw NullPointerException. More detail...