日期:2014-05-18  浏览次数:20614 次

怎么不相等 还输出啊 (最基本的问题)
感觉见鬼了

while(rs.next()){
    if(hopvalue.equals(nexthop));
    {   System.out.println( "hopvalue= "+hopvalue+ "     :       nexthop= "+nexthop);}
}


循环了3次     在tomact中显示
hopvalue=24     :       nexthop=1
hopvalue=24     :       nexthop=20
hopvalue=24     :       nexthop=24


照理不是只输出   hopvalue=24     :       nexthop=24吗??
换成
while(rs.next()){
    if(Integer.parseInt(hopvalue)==Integer.parseInt(nexthop));
    {   System.out.println( "hopvalue= "+hopvalue+ "     :       nexthop= "+nexthop);}
}
也不行

------解决方案--------------------
if(hopvalue.equals(nexthop));
这句最后那个分号去掉!!!
------解决方案--------------------
晕,你if语句后面加了;那就表明if已经结束了,所以后面的那个语句根本不会受到if的影响,当然三次都输出