黑马程序员技术交流社区

标题: 代码 [打印本页]

作者: 至尊宝的温柔    时间: 2015-10-27 21:19
标题: 代码
  1. class  {
  2.         public static void main(String[] args) {
  3.                 System.out.println("Hello World!");
  4.         }
  5. }
  6. class Animal {
  7.         private String color;
  8.         private int; leg;
  9.         public Animal(){}
  10.         public Animal(String color,int leg){
  11.                 this.color = color;
  12.                 this.leg = leg;
  13.         }
  14.         public void setColor(String color){
  15.                 this.color = color;
  16.         }
  17.         public String getColor(){
  18.                 return color;

  19.         }
  20.         public void setLeg(int leg){
  21.                 this.leg = leg;
  22.         }
  23.         public int getLeg(){
  24.                 return leg;
  25.         }
  26.         public void eat(){
  27.                 System.out.println("chifan");
  28.         }





  29. }
  30. class Cat extends Animal {
  31.         public Cat(){}
  32.         public Cat(String color,int leg){
  33.                 super(this.getColor,this.getLeg)
  34.         }
  35.         public void eat(){
  36.                 System.out.println("maochiyu");
  37.        
  38.         }


  39. }
复制代码



作者: 419798721    时间: 2015-10-28 00:01





欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) 黑马程序员IT技术论坛 X3.2