抽象和封装继承和多态.docxVIP

  • 5
  • 0
  • 约1.13万字
  • 约 16页
  • 2021-03-11 发布于天津
  • 举报
package cn .jbit.epet.obj; /** *宠物狗狗类。 * @author Lolly */ public class Dog { String name =无名氏;//昵称,默认值是无名氏 int health = 100; //健康值,,默认值是100 int love = 0; // 亲密度 String strain =聪明的拉布拉多犬;//品种 /** *输出狗狗的信息。 */ public void prin t() { System.out.println(” 宠物的自白:\n 我的名字叫+ this.name + ,健康值是+ this.health + ,和主人的亲密度是 + this.love + ,我是一只+ this.strain + 。); package cn .jbit.epet.obj; /** *宠物企鹅。 * @author Lolly */ public class Penguin { String name =无名氏;// 昵称 int health = 100; // 健康值 int love = 0; // 亲密度 String sex = Q仔;// 性别 /** *输出企鹅的信息。 */ public void prin t() { System.out.println(” 宠物的自白:\n 我的名字叫+ thi

文档评论(0)

1亿VIP精品文档

相关文档