public static void main(String[] args) { int[] x = { 1, 2, 3 }; x = null; System.out.println(x[1]); // java.lang.NullPointerException }