java不能编译 急急~~谢谢

来源:百度知道 编辑:UC知道 时间:2024/05/28 19:02:16
public class car{
public String ownername;
public int speed;
public float dirindegree;
public car(String name, float speed1, float dirindegree1){
ownername=name;
speed=speed1;
dirindegree=dirindegree1;
}
public String getownername(){

System.out.println("当前车主名字:"+ownername);
}
public int getspeed(){
System.out.println("当前车速:"+speed);
}
public float getdirindegree(){
System.out.println("当前方向盘的转向角度:"+dirindegree);
}
public int changespeed(int speed){
return speed-20;
}
public int stop(){ return 0;}

public static void main(String[] args){
car che=new car("舒马赫",300,25.0);
che.getownername();
che.getspeed();
che.getdirindegree();
System.out.println("调用changespeed()后,车速变为:"+che.changespeed( speed));
System.out.println("在调用stop()后,车速变成:"+che.stop

public class Car{
public String ownername;
public int speed;
public float dirindegree;
public Car(String name, int speed1, float dirindegree1){
ownername=name;
speed=speed1;
dirindegree=dirindegree1;
}
public String getownername(){

System.out.println("当前车主名字:"+ownername);
return ownername;
}
public int getspeed(){
System.out.println("当前车速:"+speed);
return speed;
}
public float getdirindegree(){
System.out.println("当前方向盘的转向角度:"+dirindegree);
return dirindegree;
}
public int changespeed(int speed){
return this.speed-speed;
}
public int stop(){ return 0;}

public static void main(String[] args){
Car che=new Car("舒马赫",300,25.0f);
che.getownername();
che.getspeed();
che.getdirindegree();
System.out.println("调用ch