Answers for ""java.lang.NullPointerException"

-1

nullpointerexception

public class MyClass{
private Object iAmNowNull;//This is null by default
    private Object iAmInitialized=new Object();
    public void test(){
    	System.out.println(iAmInitialized.toString());//prints that object
        System.out.println(iAmNull.toString());//throws a NullPointerException
}
Posted by: Guest on April-11-2021

Code answers related to ""java.lang.NullPointerException"

Browse Popular Code Answers by Language