Topic: 求助:该程序为什么不循环执行? |
Print this page |
1.求助:该程序为什么不循环执行? | Copy to clipboard |
Posted by: jjl0604 Posted on: 2005-09-14 22:27 public class Sign { public static void main(String args[]) { String compare ="NOT"; while(compare == "NOT") {System.out.println("please input first data:"); int a = Console.readInt(); System.out.println("please input second data:"); int b = Console.readInt(); System.out.println("Bigcount:" + bigSign(a,b)); System.out.println("Samecount:" + sameSign(a,b)); System.out.println("Smallcount:" + smallSign(a,b)); System.out.println("Over(YES/NOT)?"); compare = Console.readString(); } } |
2.Re:求助:该程序为什么不循环执行? [Re: jjl0604] | Copy to clipboard |
Posted by: why Posted on: 2005-09-14 22:37 not ==, use equals : while(compare.equals("NOT")) BTW, YES/NOT looks odd, use YES/NO |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |