时间调用

mumu_xi 2013-08-14 12:35:46
class Human{
String name;
String sex;
int age;
String add;
void work(){
System.out.println("i am working!");
}
void eat(){
System.out.println("i am eating!");
}
String getState(int time){
String state=null;
if(time>0 && time<24){
if(time>8 && time<17)
System.out.println("i am working");
else if(time>17 && time<22)
System.out.println("i am studying");
else if(time<8 || time>22)
System.out.println("i am sleeping");
}else
System.out.println("the time is wrong");
return state;

}
}
public class Day64 {
public static void main(String args[]){
Human mumu=new Human();
mumu.name="mumu";
mumu.sex="girl";
mumu.add="zhanjiang";
System.out.println(mumu.name+"what are u doing at 9 oclock?");
System.out.println(mumu.getState(9));
System.out.println("what about 23?");
System.out.println(mumu.getState(23));
}
}
请问为什么调用不了时间?得出来的结果是这个?
mumuwhat are u doing at 9 oclock?
the wrong time
what about 23?
the wrong time
...全文
122 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
末日哥 2013-08-14
  • 打赏
  • 举报
回复
真不知道你的the wrong time哪来的。。
lkq_david 2013-08-14
  • 打赏
  • 举报
回复
运行没什么毛病呀,很正常呢
ghostkngiht 2013-08-14
  • 打赏
  • 举报
回复
state为啥没赋值????
mumu_xi 2013-08-14
  • 打赏
  • 举报
回复
我也觉得郁闷呢
菖蒲老先生 2013-08-14
  • 打赏
  • 举报
回复
神马玩意? 没见到哪儿打印 the wrong time 的。。。

62,616

社区成员

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

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