siyuliu  

2025年11月13日

摘要: ![image](https://img2024.cnblogs.com/blog/3441892/202511/3441892-20251113183523325-148391993.png) ![image](https://img2024.cnblogs.com/blog/3441892/202511/3441892-20251113183828180-1403832748.png) ![i 阅读全文
posted @ 2025-11-13 18:40 nnnnnnunn 阅读(3) 评论(0) 推荐(0)

2025年11月12日

摘要: ![image](https://img2024.cnblogs.com/blog/3441892/202511/3441892-20251112115544910-1442128147.png) ![image](https://img2024.cnblogs.com/blog/3441892/202511/3441892-20251112115558296-203998385.png) ![i 阅读全文
posted @ 2025-11-12 12:01 nnnnnnunn 阅读(1) 评论(0) 推荐(0)
 
摘要: try catch处理异常 public class Main { public static void main(String[] args) { int a=1; int b=0; try{ System.out.println(a/b); } catch(Throwable e){//想要捕获 阅读全文
posted @ 2025-11-12 10:48 nnnnnnunn 阅读(4) 评论(0) 推荐(0)
 
摘要: 类内类 方法内类(局部内部类) 阅读全文
posted @ 2025-11-12 10:06 nnnnnnunn 阅读(4) 评论(0) 推荐(0)
 
摘要: stu接口 public class teacher extends stu{ public void say() { System.out.println("teacher"); } } teacher类实现接口 public class teacher implements stu,接口n{ / 阅读全文
posted @ 2025-11-12 09:56 nnnnnnunn 阅读(2) 评论(0) 推荐(0)
 
摘要: stu.java(抽象类不能new,只能靠子类去实现) public abstract class stu { public abstract void say(); } 阅读全文
posted @ 2025-11-12 09:39 nnnnnnunn 阅读(4) 评论(0) 推荐(0)

2025年11月11日

摘要: static可以直接调用或者类名.方法 类名.变量 public class Main { private static int m; public static void main(String[] args) { System.out.println(Main.m);//static直接调用; 阅读全文
posted @ 2025-11-11 22:19 nnnnnnunn 阅读(3) 评论(0) 推荐(0)
 
摘要: stu父类 public class stu { public void say() { System.out.println("stu"); } } teacher子类 public class teacher extends stu{ public void go() { System.out. 阅读全文
posted @ 2025-11-11 21:59 nnnnnnunn 阅读(2) 评论(0) 推荐(0)
 
摘要: instanceof(检测左侧的对象是否为右侧类或接口的实例) public class Main { public static void main(String[] args) { //方法的调用只和左边定义的数据类型有关 Object object=new teacher(); System. 阅读全文
posted @ 2025-11-11 21:21 nnnnnnunn 阅读(5) 评论(0) 推荐(0)
 
摘要: main public class Main { public static void main(String[] args) { //方法的调用只和左边定义的数据类型有关 stu s=new teacher(); s.say();//stu,如果不加static,子类重写父类的方法输出teache 阅读全文
posted @ 2025-11-11 19:20 nnnnnnunn 阅读(5) 评论(0) 推荐(0)