摘要: public class Demo01 { public static void main(String[] args) { int a =1; int b =0; //ctrl+alt+T //假设要捕获多个异常:从小到大 try {//监控区域 new Demo01().a(); } catch 阅读全文
posted @ 2024-01-23 11:58 fightownself 阅读(6) 评论(0) 推荐(0) 编辑
摘要: public class Outer { private int id =10; public void out(){ System.out.println("这是外部类的方法"); } public class Inner{ public void in() { System.out.printl 阅读全文
posted @ 2024-01-23 10:50 fightownself 阅读(3) 评论(0) 推荐(0) 编辑
摘要: 接口的本质就是契约 作用: 约束 定义一些方法,让不同的人实现 public abstract public static final 接口不能实例化,接口中没有构造方法 implements可以实现多个接口 必须重写接口中的方法 //定义的关键字 interface ,接口都需要有实现类publi 阅读全文
posted @ 2024-01-23 10:09 fightownself 阅读(2) 评论(0) 推荐(0) 编辑