In Java we can declare an array using the following:
String[] array = new String[10];
int size = array.length;
Does this mean that the arra
Observe below code snippet and output.
public class Tester {
int a[];
public static void main(String[] args) {
System.out.println(new Tester().a);// null
System.out.println(new Tester().a[0]);// Exception in thread "main" java.lang.NullPointerException \n at mainclass.Tester.main(Tester.java:10)
}
}
clearly array a is treated as object.