摘要: public class day_6_25_1 { public static void main(String[] args){ Zi1 zi1 = new Zi1(); zi1.setEat(); } } /* 1,什么是方法的重写? 在子类继承父类中,子类出现与父类方法的声明完全一直的方法,就 阅读全文
posted @ 2024-06-25 20:28 公子Learningcarer 阅读(1) 评论(0) 推荐(0) 编辑
摘要: public class day_6_25 { public static void main(String[] args){ Zi zi = new Zi(); zi.getName(); }; } /* 在子父类继承 */ class Fu{ String name = "张三"; public 阅读全文
posted @ 2024-06-25 20:00 公子Learningcarer 阅读(1) 评论(0) 推荐(0) 编辑
摘要: //this在private关键字后标准代码该怎么写? /*this代表对象得引用,那个对象调用this所在得方法,this就代表那个对象 this作用:this可以掘金局部变量隐藏成员变量得问题*/ class phone { String name; int age; public void s 阅读全文
posted @ 2024-06-25 15:31 公子Learningcarer 阅读(1) 评论(0) 推荐(0) 编辑
摘要: /* * 手机类 * 属性: * 品牌brand * 价格price * 行为: * 打电话call() * 发短信sendMessage() * 玩游戏playGame() * * * */ private 为是私有方法只能在类内部使用 public class Do { public stati 阅读全文
posted @ 2024-06-25 14:50 公子Learningcarer 阅读(1) 评论(0) 推荐(0) 编辑