package com.jm.tryTest;
public class TestException {
/**
* 运行时异常
* @param args
*/
public static void main(String[] args) {
//1.数组下标越界
//java.lang.ArrayIndexOutOfBoundsException
int []scores=new int[10];
//scores[10]=100;
//2.空指针异常
//java.lang.NullPointerException
int [][] yh=new int[10][];
// yh[0][0]=10;
//3.数学异常
//java.lang.ArithmeticException
// int i=10/0;
//4. 类型转换异常
//java.lang.ClassCastException
Object obj=new TestException();
// Person tp=(Person) obj;
//5.Error 对Error 无能为力,溢出
//java.lang.StackOverflowError
main(new String[]{});
//6.编译时异常
//(try:尝试)
try {
Class.forName("com.jm.tryTest.Person.print()");
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
}