import java.util.ArrayList;
public class arr {
public String[] i;
public static void main (String[] args) {
ArrayList list = new ArrayList();
list.add("hello");
list.add("hello to you");
list.add("I Am Another Test!!");
String i[] = (String[]) list.toArray(new String[0]);
moo moo = new moo();
}
}
-----------------------------------------------------------------------
public class moo {
public moo() {
arr arr = new arr();
System.out.print(arr.i[0]);
}
}
-----------------------------------------------------------------------
Output:
Exception in thread "main" java.lang.NullPointerException
at moo.<init>(moo.java:6)
at arr.main(arr.java:19)