class MyClass1 { static String arr[]; public static void main(String []args) { System.out.println(arr[0]); } } y thi sgives nullpointerexception, it should be initialized to null & print "null"
Thomas Paul
mister krabs
Ranch Hand
Joined: May 05, 2000
Posts: 13974
posted
0
You never created the array! All you have is a pointer to a String array. Do this: static String arr[] = new String[1]; And you'll get null as your output.