天津科技大学Java第六章 异常处理.pptxVIP

  • 6
  • 0
  • 约 24页
  • 2016-12-31 发布于江西
  • 举报
天津科技大学Java第六章 异常处理.pptx

第六章 异常处理? 异常(Exception)的概念?异常处理方法?自定义异常类1 public class HelloWorld{2 public static void main(String args[ ]){3int i=0;4 String greetings[ ]={ “Hello World!”,”Hello!”,5 “HELLO WORLD!!”};6 while ( i4){7System.out.println(greetings[i]);8i++;9 }10 }11 }Hello World!Hello!HELLO WORLD!Java.lang.ArrayIndexOutOfBoundsException at HelloWorld.main(HelloWorld.java:7)异常的概念异常在程序运行时打断正常程序流程的任何不正常情况。异常的情况试图打开的文件不存在网络链接中断操作符越界要加载类文件不存在Java中定义了各种异常Java中定义的异常VirtualMachineErrorErrorAWTErrorArithmeticExceptionNullPointerExceptionRuntimeExceptionThrowableIndexOutOfBoundsExceptionEOFExceptionExceptionIOE

文档评论(0)

1亿VIP精品文档

相关文档