package com.wc.lianxi;
public class test1 {
public static void main(String[] args){
human1 h = new human1();
h.play();
h.sleep();
h.eat();
}
}
class animal1 {
String color;
int age;
String job;
animal1(int x){
System.out.println(x);
}
animal1(String color,int age,String job){
this.color =color;
this.age =age;
this.job =job;
System.out.println("一个 "+age+"岁的"+color+"人"+job+"\t父构造方法");
}
void eat(){
System.out.println("父吃饭");
}
void sleep(){
System.out.println("父睡觉");
}
void play(){
System.out.println("父玩耍");
}
}
class human1 extends animal1{
human1(){
super("黑",18,"worker");
}
void play(){
System.out.println("子玩耍");
}
void eat(){
System.out.println("子吃饭");
}
void sleep(){
System.out.println("子睡觉");
}
}
public class test1 {
public static void main(String[] args){
human1 h = new human1();
h.play();
h.sleep();
h.eat();
}
}
class animal1 {
String color;
int age;
String job;
animal1(int x){
System.out.println(x);
}
animal1(String color,int age,String job){
this.color =color;
this.age =age;
this.job =job;
System.out.println("一个 "+age+"岁的"+color+"人"+job+"\t父构造方法");
}
void eat(){
System.out.println("父吃饭");
}
void sleep(){
System.out.println("父睡觉");
}
void play(){
System.out.println("父玩耍");
}
}
class human1 extends animal1{
human1(){
super("黑",18,"worker");
}
void play(){
System.out.println("子玩耍");
}
void eat(){
System.out.println("子吃饭");
}
void sleep(){
System.out.println("子睡觉");
}
}