摘要: ### demo ``` class Outer { // 外部类 private String msg = "www.mldn.cn"; // 私有成员属性 public void fun() { // 普通方法 Inner in = new Inner(); // 实例化内部类对象 in.pri 阅读全文
posted @ 2023-07-02 20:31 盘思动 阅读(5) 评论(0) 推荐(0) 编辑
摘要: ### demo ``` public class JavaDemo { public static void main(String args[]) throws Exception { int x = 10; // 中间可能会经过许多条程序语句,导致变量x的内容发生改变 assert x == 阅读全文
posted @ 2023-07-02 16:42 盘思动 阅读(3) 评论(0) 推荐(0) 编辑
摘要: ### demo * 在项目开发中,会大量接触自定义异常 * 本节案例,综合本章节很多案例。 ``` class BombException extends Exception {// 自定义强制处理异常 public BombException(String msg){ super(msg);// 阅读全文
posted @ 2023-07-02 11:50 盘思动 阅读(2) 评论(0) 推荐(0) 编辑
摘要: ### demo1 parseInt() 方法不处理异常 ``` public class JavaDemo { public static void main(String args[]) { int num = Integer.parseInt("123");// 课程中从官网手册,查看pars 阅读全文
posted @ 2023-07-02 11:35 盘思动 阅读(2) 评论(0) 推荐(0) 编辑
摘要: ### demo1 这种模型,开发中经常用 ``` class MyMath { public static int div(int x, int y) throws Exception { // 异常抛出 int temp = 0; System.out.println("*** 【START】除 阅读全文
posted @ 2023-07-02 11:24 盘思动 阅读(7) 评论(0) 推荐(0) 编辑
摘要: ### demo ``` public class JavaDemo { public static void main(String args[]) { try { throw new Exception("自己抛着玩的"); } catch (Exception e){ e.printStack 阅读全文
posted @ 2023-07-02 11:12 盘思动 阅读(1) 评论(0) 推荐(0) 编辑
摘要: ### demo1 ``` class MyMath { public static int div(int x,int y) throws Exception { return x / y; } } public class JavaDemo { public static void main(S 阅读全文
posted @ 2023-07-02 09:54 盘思动 阅读(2) 评论(0) 推荐(0) 编辑
摘要: ### demo Exception 捕获所有异常;在异常catch处理中,把捕获异常范围大的放小的之后 ``` public class JavaDemo { public static void main(String args[]) { System.out.println("【1】***** 阅读全文
posted @ 2023-07-02 00:04 盘思动 阅读(16) 评论(0) 推荐(0) 编辑