package Sample;
public class Sample4Array {
public static void main(String[] args) {
int a[] = new int[10];
System.out.println(a[1]);
for(int i=0;i<a.length;i++) {
System.out.println(a[i]);
//default value is 0
}
Integer x[] = new Integer[10];
for(int i=0;i<x.length;i++) {
System.out.println(x[i]);
//default value is null & not throwing an exception.
}
}
}
To consider; the first for loop returns 0 as default value & second for loop even its default value is null then also it's not throwing any exception