上一页 1 ··· 11 12 13 14 15 16 17 18 19 ··· 125 下一页
摘要: ### demo1 ““ ``` class Message { // 定义泛型类对象 private T content;// 泛型属性 public void setContent(T content){ this.content = content; } public T getContent 阅读全文
posted @ 2023-06-11 11:32 盘思动 阅读(9) 评论(0) 推荐(0) 编辑
摘要: ### demo1 ``` class Point {// T属于类型标记,可以设置多个标记 private T x; private T y; public void setX(T x){ this.x = x; } public void setY(T y){ this.y = y; } pub 阅读全文
posted @ 2023-06-11 10:17 盘思动 阅读(2) 评论(0) 推荐(0) 编辑
摘要: * Object 可以接受所有的数据类型,这是泛型产生的主要依据~~~ ``` class Point { private Object x; private Object y; public void setX(Object x){ this.x = x; } public void setY(O 阅读全文
posted @ 2023-06-11 09:30 盘思动 阅读(3) 评论(0) 推荐(0) 编辑
摘要: ### 常见面试题 | No | 区别 | 抽象类 | 接口 | | | | | | |1. | 定义 | abstract class 抽象类名称 | interface 接口名称 | |2. | 组成 | 构造,普通方法,静态方法,全局常量,成员 | 抽象方法,全局常量,普通方法,static方 阅读全文
posted @ 2023-06-11 09:05 盘思动 阅读(9) 评论(0) 推荐(0) 编辑
摘要: ``` 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) 编辑
上一页 1 ··· 11 12 13 14 15 16 17 18 19 ··· 125 下一页