Array Output 1
public class JavaRecipe{
public static void main(String[] jr){
int[] arr = new int[0]; // Line 1
System.out.println(arr.length); // Line 2
System.out.println(arr.length); // Line 2
}
}
1. Compilation error at Line 1 : size of array cant be 0
2. Compiles fine and gives output as 0
3. Runntime error at line 2 : NullPointerException
Comments
Post a Comment