nullpointerexception in android studio code example
Example 1: nullpointerexception java
int x;
x = 10;
Example 2: 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
}