Java 实例 - 获取异常的堆栈信息
Java 教程
· 2019-02-11 10:44:00
以下实例演示了使用异常类的 printStack() 方法来获取堆栈信息:
Main.java 文件
public class Main{
public static void main (String args[]){
int array[]={20,20,40};
int num1=15,num2=10;
int result=10;
try{
result = num1/num2;
System.out.println("The result is" +result);
for(int i =5; i>=0; i--) {
System.out.println("The value of array is" +array[i]);
}
}
catch (Exception e) {
e.printStackTrace();
}
}
}
以上代码运行输出结果为:
The result is1 java.lang.ArrayIndexOutOfBoundsException: 5 at testapp.Main.main(Main.java:28)
点击查看所有 Java 教程 文章: https://www.codercto.com/courses/l/12.html
Pro CSS and HTML Design Patterns
Michael Bowers / Apress / April 23, 2007 / $44.99
Design patterns have been used with great success in software programming. They improve productivity, creativity, and efficiency in web design and development, and they reduce code bloat and complexit......一起来看看 《Pro CSS and HTML Design Patterns》 这本书的介绍吧!