摘要: ``` interface IEat { // 定义核心业务标准 public void get(); // 业务方法 } class EatReal implements IEat { // 定义真实主题类 public void get(){ System.out.println("【真实主题】 阅读全文
posted @ 2023-06-10 22:42 盘思动 阅读(9) 评论(0) 推荐(0) 编辑
摘要: ### demo1 ``` interface IFood { public abstract void eat(); } class Bread implements IFood { public void eat(){ System.out.println("吃面包~"); } } class 阅读全文
posted @ 2023-06-10 22:04 盘思动 阅读(3) 评论(0) 推荐(0) 编辑
摘要: ``` interface IUSB { public boolean check(); public void work(); } class Computer { public void plugin(IUSB usb){// 电脑上使用USB设备 ??什么格式 if(usb.check()){ 阅读全文
posted @ 2023-06-10 16:56 盘思动 阅读(4) 评论(0) 推荐(0) 编辑
摘要: * default,static不可作为主要的设计模式,这个只是补救措施。 ### demo1 接口中追加普通方法 接口定义方法加上default,子类实现就不是非得覆写了 ``` interface IMessage { public String message();// 抽象方法,abstra 阅读全文
posted @ 2023-06-10 16:15 盘思动 阅读(3) 评论(0) 推荐(0) 编辑
摘要: ### demo1 接口简单基本定义 ``` interface IMessage {// 定义接口 public static final String INFO = "www.baidu.com";// 全局常量 public abstract String getInfo(); } class 阅读全文
posted @ 2023-06-10 10:32 盘思动 阅读(3) 评论(0) 推荐(0) 编辑
摘要: * 包装类除了有引用支持外,还提供数据类型转换功能 ### demo1 字符串转数值 ``` String str = "123"; int num = Integer.parseInt(str);// 字符串转为int 转换过程中,字符串必须都由数组组成,否则报错!!!(NumberFormatE 阅读全文
posted @ 2023-06-10 09:24 盘思动 阅读(3) 评论(0) 推荐(0) 编辑