当前位置: 代码迷 >> Eclipse >> java新手 有没有人帮小弟我结局这个有关问题
  详细解决方案

java新手 有没有人帮小弟我结局这个有关问题

热度:54   发布时间:2016-04-23 12:27:23.0
java新手 有没有人帮我结局这个问题
public class Bus extends carcare {
  public int max_Passenger=35;
  public int current_Passenger=0;
  public boolean getOnBUs(int p_amout){
 
if(isBus)
  {
  int temp=current_Passenger+p_amout;
  if(temp>max_Passenger)
  {
  return false;
  }
  else {
current_Passenger=temp;
return true;
}
  }
  return false;
}
  public boolean getDownBus(int p_amout) {
  if(isBus){
  int temp=current_Passenger-p_amout;
  if(temp<0)
  {
  return false;
  }
  else {
current_Passenger=temp;
return true;
}
  }
 
return false;
}
   
}

Exception in thread "main" java.lang.Error: 无法解析的编译问题
isBus cannot be resolved to a variable 错误额如下

我在前面加了public boolean isBus=false 
编译时通过 但是结果不对!!!
跪求高手指点~

------解决方案--------------------
打断点调不就行了吗,看他是怎么走的呀
------解决方案--------------------
isBus cannot be resolved to a variable

还有你这个carcare父类也没写啊。。。还有一般类名都是首字母大写的,注意一下

他都给你写出来了,isBus不是一个可解析的变量。。。
  相关解决方案