JAVA实践第五章.docVIP

  • 0
  • 0
  • 约6.58千字
  • 约 8页
  • 2018-03-23 发布于河南
  • 举报
JAVA实践第五章

第五章 JAVA异常实验 目的与要求:一定要自己动手,一行一行代码亲自敲进去,理解,编译,并运行,掌握其使用方法。 Exc0.java:编译如下程序,观察运行结果,如何解决? class Exc0 { public static void main(String args[]) { int d = 0; int a = 42 / d; } } Exc1.java:定义静态方法,编译如下程序,观察运行结果,如何解决? class Exc1 { static void subroutine() { int d = 0; int a = 10 / d; } public static void main(String args[]) { Exc1.subroutine(); } } 3、Exc2.java:掌握构造方法的重载和调用 class Exc2 { public static void main(String args[]) { int d, a; try { // 监控制代码段 d = 0; a = 42 / d; System.out.println(This will not be printed.); } catch (Arithmetic

文档评论(0)

1亿VIP精品文档

相关文档