- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Why is NullPointerException in Java?
NullPointerException is a runtime exception and it is thrown when the application try to use an object reference which has a null value.
For example, using a method on a null reference.
Object ref = null; ref.toString(); // this will throw a NullPointerException
- Related Articles
- Why can I throw null in Java and why does it upcast to a NullPointerException?
- How to resolve a NullPointerException in Java?
- When does a NullPointerException get thrown in java?
- What happens if NullPointerException is not handled in main method of java?
- When does a Java Array Throws a NullPointerException?
- Why string is immutable in Java?
- Why StringBuffer is mutable in Java?
- Why @SafeVarargs is required in Java 9?
- Why Abstract Class is used in Java?
- Why multiple inheritance is not supported in Java
- Why the main () method in Java is always static?
- Why String class is immutable or final in Java?
- Why the transient variable is not serialized in Java?
- Why is Java slower than C++ programs?
- Why is Java a Robust Programming Language?

Advertisements