package 实验;
public class Animal
{
private String name;
private double height;
private double weight;
public Animal(String name,double height,double weight)
{
this.name=name;
this.height=height;
this.weight=weight;
}
public void run()
{
System.out.println(this.name+"跑起来了.");
}
public void jump()
{
System.out.println("哈哈,快看,"+this.name+"跳的好高啊!");
}
public void zou()
{
System.out.println("走啊-走啊-走啊走.");
}
}
public class Animal {
private String name;
private String height;
private String weight;
/**
* @return the height
*/
public String getHeight() {
return height;
}
/**
* @param height
* the height to set
*/
public void setHeight(String height) {
this.height = height;
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name
* the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
* @return the weight
*/
public String getWeight() {
return weight;
}
/**
* @param weight
* the weight to set
*/
public void setWeight(String weight) {
this.weight = weight;
}
public void run(){
System.out.println("跑");
}
public void jump(){
System.out.println("跳");
}
public void walk(){
System.out.println("走");
}
}
。。。。。还是自己写吧
这是最最基础的OO思想啊~~
public class Animal{
String name;
float height;
float weight;
public void run(){}
public void jump(){}
public void walk(){}
}
不用高手的