提示无法找到main,怎么回事?

songlijun 2005-09-10 10:26:34
我已经定义了main,怎么提示却找不到?class VocanoRobot{
String status;
int speed;
float temperature;
void checktemperature(){
if(temperature>600){
status="return home";
speed=5;
}
}
public void shouAttribute(){
System.out.println("status=" + status);
System.out.println("speed=" + speed);
System.out.println("temperature=" + temperature);
}
/*public static void main(String[] args){
VocanoRobot dante=new VocanoRobot("expoing",2);
dante.shouAttribute();
dante.temperature=520;}
*/
VocanoRobot(String status,int speed){
this.status=status;
this.speed=speed;
}
}
class WalkRobot extends VocanoRobot{
String Color;
public WalkRobot(String status,int speed,String Color){
super(status,speed);
this.Color=Color;
}
void speak(String talk){
System.out.println(talk);
}
public static void main(String [] args){
WalkRobot sony=new WalkRobot("walking",4,"red");
sony.shouAttribute();
sony.speak("i am walking");
}

}
错误信息为:
Exception in thread "main" java.lang.NoSuchMethodError: main
...全文
206 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
interhanchi 2005-09-11
  • 打赏
  • 举报
回复
你要 java WalkRobot
rainly1985 2005-09-11
  • 打赏
  • 举报
回复
我运行你的程序没问题啊,
这是结果:
status=walking
speed=4
temperature=0.0
i am walking

你的文件名写对了吗,就是在javac的时候,是不是写成了别的文件啊,反正你的程序没问题
yanransoft 2005-09-11
  • 打赏
  • 举报
回复
对不起,没看清楚。是java WalkRobot
yanransoft 2005-09-11
  • 打赏
  • 举报
回复
java VocanoRobot试试
crazy4stef 2005-09-11
  • 打赏
  • 举报
回复
是classpath问题~
believefym 2005-09-11
  • 打赏
  • 举报
回复
classpath前加.;
scfox 2005-09-11
  • 打赏
  • 举报
回复
有可能是你的ClassPath不正确.

62,614

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧