package
com.animaltest;
public
class
Animal {
private
String name;
private
int
age;
public
Animal(String name,
int
age){
this
.name = name;
this
.age = age;
}
public
String getName() {
return
name;
}
public
void
setName(String name) {
this
.name = name;
}
public
int
getAge() {
return
age;
}
public
void
setAge(
int
age) {
this
.age = age;
}
public
void
outPut(){
System.out.println(
"name:"
+
this
.getName());
System.out.println(
"age:"
+
this
.getAge());
}
}
package
com.animaltest;
public
interface
Eattable {
void
beatted();
}
package
com.animaltest;
public
class
Bird
extends
Animal{
private
String wing;
private
String flyDistance;
public
Bird(String name,
int
age) {
super
(name, age);
this
.wing = wing;
this
.flyDistance = flyDistance;
}
public
String getWing() {
return
wing;
}
public
void
setWing(String wing) {
this
.wing = wing;
}
public
String getFlyDistance() {
return
flyDistance;
}
public
void
setFlyDistance(String flyDistance) {
this
.flyDistance = flyDistance;
}
@Override
public
void
outPut() {
super
.outPut();
System.out.println(
"wing:"
+
this
.getWing());
System.out.println(
"flyDistance:"
+
this
.getFlyDistance());
}
}
package
com.animaltest;
public
class
Beast
extends
Animal
implements
Eattable{
private
String localPlace;
private
String food;
public
Beast(String name,
int
age) {
super
(name, age);
this
.localPlace = localPlace;
this
.food = food;
}
public
String getLocalPlace() {
return
localPlace;
}
public
void
setLocalPlace(String localPlace) {
this
.localPlace = localPlace;
}
public
String getFood() {
return
food;
}
public
void
setFood(String food) {
this
.food = food;
}
@Override
public
void
beatted() {
System.out.println();
}
@Override
public
void
outPut() {
super
.outPut();
System.out.println(
"localPlace:"
+
this
.getLocalPlace());
System.out.println(
"food:"
+
this
.getFood());
}
}