package com.ctgu.java.exer; public class TestException { public static void main(String[] args) { //1.数组下标越界异常: // int[] i = new int[10]; // i[0] = 90; // i[9] = 99; // for(int m =0; m<i.length;m++){ // System.out.println(i[m]); // } // //2空指针异常 // boolean[] b = new boolean[3]; // b = null; // System.out.println(b[0]); // TODO Auto-generated method stub String[] str = new String[4]; //str[3] = new String("AA"); System.out.println(str[3].toString()); int[][] j = new int [3][]; j[2][0] = 12; } }
数组常见异常 学习笔记
原创
©著作权归作者所有:来自51CTO博客作者小靳abc的原创作品,请联系作者获取转载授权,否则将追究法律责任
上一篇:二维数组 学习笔记
下一篇:二维数组练习 学习笔记
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
面试最常见算法3—数组
面试常见算法—数组篇
算法 面试常见算法 数组 矩阵 JAVA -
HarmonyOS NEXT 学习笔记
鸿蒙os 页面一键置灰
页面效果 API -
[Java 学习笔记] 异常处理
Error表示严重的错误,程序对此一般无能为力,例如:OutOfMemoryError:内存耗尽 NoClassDefFoundEr
1024程序员节 java 子类 抛出异常 构造方法