急急急!!!JAVA---请java高手帮帮忙!!

2024-12-14 05:40:32
推荐回答(5个)
回答1:

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("走啊-走啊-走啊走.");
}
}

回答2:

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("走");
}
}

回答3:

。。。。。还是自己写吧
这是最最基础的OO思想啊~~

回答4:

public class Animal{
String name;
float height;
float weight;
public void run(){}
public void jump(){}
public void walk(){}
}

回答5:

不用高手的