Top "Nullpointerexception" questions

The Java exception thrown when an application attempts to use null in a case where an object is required.

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException Error

Hello I'm a new programmer at an high school level as a result I do not know much about programming …

nullpointerexception runtime-error drjava awt-eventqueue
How do you tell if a checkbox is selected in Selenium for Java?

I am using Selenium in Java to test the checking of a checkbox in a webapp. Here's the code: private …

java selenium attributes checkbox nullpointerexception
Difference between null and empty string

What is the difference between a null string (String s = null) and an empty string (String s = "")? This is what …

java string null nullpointerexception
- java.lang.NullPointerException - setText on null object reference

This is what I'm trying to do for several hours: I've got a MainActivity.java file (listing below) and a …

java android nullpointerexception
if statement checks for null but still throws a NullPointerException

In this code. public class Test { public static void testFun(String str) { if (str == null | str.length() == 0) { System.out.println("…

java nullpointerexception
IllegalArgumentException or NullPointerException for a null parameter?

I have a simple setter method for a property and null is not appropriate for this particular property. I have …

java exception null nullpointerexception illegalargumentexception
How to use @Nullable and @Nonnull annotations more effectively?

I can see that @Nullable and @Nonnull annotations could be helpful in preventing NullPointerExceptions but they do not propagate very …

java annotations nullpointerexception nullable code-standards
Best way to check for null values in Java?

Before calling a function of an object, I need to check if the object is null, to avoid throwing a …

java null nullpointerexception
No Exception while type casting with a null in java

String x = (String) null; Why there is no exception in this statement? String x = null; System.out.println(x); It …

java nullpointerexception typecasting-operator
Android. Fragment getActivity() sometimes returns null

In developer console error reports sometimes I see reports with NPE issue. I do not understand what is wrong with …

android android-fragments android-activity android-asynctask nullpointerexception