首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Eclipse开发 >

if else-if 有关问题

2012-09-17 
if else-if 问题if (i.equals(input.next())) {if (xs.equals(input.next())) {StudentNo input.nex

if else-if 问题
if ("i".equals(input.next())) {
if ("xs".equals(input.next())) {
StudentNo = input.nextInt();
StudentName = input.next();
BirthDay = input.next();
Student.creat(StudentNo, StudentName, BirthDay);
//System.out.print("你增加的语句有误");
}

lse if ("d".equals(input.next())){
if("xs".equals(input.next())){
StudentNo=input.nextInt();
Student.delete(StudentNo);
System.out.print("你删除的语句有误");
}
}
else if("u".equals(input.next())){
if("xs".equals(input.next())){
StudentNo = input.nextInt();
Student.update(StudentNo);
System.out.print("你更改的语句有误");
}
}*/



为什么条件满足lse if ("d".equals(input.next())){
if("xs".equals(input.next())){
StudentNo=input.nextInt();
Student.delete(StudentNo);
System.out.print("你删除的语句有误");
}
}
后就不会执行这语句

[解决办法]
根本就没进入if中去吧!!!!
能解释下,if("xs".equals(input.next())),,,xs为啥要引号吗???
你这是想干嘛!!!
[解决办法]
把if中变量的引号删了!!!
[解决办法]
后面的肯定不会执行了,你用的是else if 后面的else...情况是不会进行判断的。

热点排行