空指针异常总结

           空指针异常:NullPointerException
	//情况一:
	int[] arr1 = new int[]{1,2,3};
	arr1 = null;
	System.out.println(arr1[0]);
	
	//情况二:
	int[][] arr2 = new int[4][];
	System.out.println(arr2[0][0]);
	
	//情况三:
	String[] arr3 = new String[]{"AA","BB","CC"};
	arr3[0] = null;
	System.out.println(arr3[0].toString());
posted @ 2020-02-01 15:52  DoBetteri  阅读(157)  评论(0编辑  收藏  举报