随笔分类 -  异 常

摘要:1.写一个父类Dad类 import java.io.IOException; public class Dad { public void show()throws IOException { // Dad类的show()方法,抛出一个 IOException异常 System.out.print 阅读全文
posted @ 2019-11-06 14:32 小茅棚 阅读(238) 评论(0) 推荐(0) 编辑
摘要:1.写一个Student学生类,包含 name, id属性 public class Student implements Comparable<Student> { private int id; private String name; public Student() { super(); } 阅读全文
posted @ 2019-11-06 14:30 小茅棚 阅读(431) 评论(0) 推荐(0) 编辑
摘要:1.算数异常 java.lang.ArithmeticException public class RuntimeException { public static void main(String[] args) { //发生算数异常 int a = 10; int b = 0; int res= 阅读全文
posted @ 2019-11-06 14:29 小茅棚 阅读(194) 评论(0) 推荐(0) 编辑
摘要:看几段代码: import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; // 检测异常 (编译期间产生异常) public class CheckExceptio 阅读全文
posted @ 2019-11-06 14:27 小茅棚 阅读(220) 评论(0) 推荐(0) 编辑
摘要:一、概念 1、基本概念 异常(Exception)本质就是不正常之意。主要指Java程序在运行期间产生的错误,程序编译通过并不代表着在运行时不会出错。 作用:通过异常提示信息可以快速的知道程序的问题,有助于开发者编写出更加健壮的程序,这是异常最主要的作用。 java.lang.Throwable类是 阅读全文
posted @ 2019-10-25 12:10 小茅棚 阅读(226) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示