473,386 Members | 1,721 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

can't get out from while loop using string input

Dear all,
I'm really appreciated if anyone can help me.
I would like to ask regarding the following code...

[B]System.out.println("Enter Pre_condition or q to quit):");
while(condition.equalsIgnoreCase("q")==false)
{
condition = Input.nextLine();
if(condition.equalsIgnoreCase ("q"))
break;
else
PreCondition[count] = condition;
} [/b]


My problem is I can't get out from the while loop. I really weird.
I've used many others functions for string such as "compareTo,equals",
however it still didn't work... the while loop still can't stop when the user
entered "q" as an input.
I'm really hope that anybody can help me.
Thank you very much for anyone help.

Regards,
Normadiah
Dec 27 '06 #1
3 11365
r035198x
13,262 8TB
Dear all,
I'm really appreciated if anyone can help me.
I would like to ask regarding the following code...

[B]System.out.println("Enter Pre_condition or q to quit):");
while(condition.equalsIgnoreCase("q")==false)
{
condition = Input.nextLine();
if(condition.equalsIgnoreCase ("q"))
break;
else
PreCondition[count] = condition;
} [/b]


My problem is I can't get out from the while loop. I really weird.
I've used many others functions for string such as "compareTo,equals",
however it still didn't work... the while loop still can't stop when the user
entered "q" as an input.
I'm really hope that anybody can help me.
Thank you very much for anyone help.

Regards,
Normadiah
Try



Expand|Select|Wrap|Line Numbers
  1. System.out.println("Enter Pre_condition or q to quit):");
  2. String condition = Input.nextLine();
  3. while(!condition .equalsIgnoreCase("q")) {
  4.     PreCondition[count] = condition;
  5.     System.out.println("Enter Pre_condition or q to quit):");
  6.     condition = Input.nextLine();
  7.     count++;
  8. }
Dec 28 '06 #2
Dear r035198x,

Thank you very much for your help. It's work :)
Dec 28 '06 #3
r035198x
13,262 8TB
Dear r035198x,

Thank you very much for your help. It's work :)
Welcome. Hope you'll come back for more help or to help others where you can as well.
Dec 28 '06 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Shufen | last post by:
Hi, I'm a newbie that just started to learn python, html and etc. I have some questions to ask and hope that someone can help me on. I'm trying to code a python script (with HTML) to get...
10
by: gogogo_1001 | last post by:
Dear all, I don't understand why "delete" works well on destructing a object, but fails to destruct a vector of it. Any of your comment is highly appreciated! Following is the program...
2
by: mahurshi | last post by:
I am trying to read a file full of numbers followed by spaces (and then do some cool stuff with it) My input file looks like this 1 0 1 0 1 0 1 1 1 0 0 1 1 0
18
by: Jen | last post by:
I'm using Microsoft's own VB.NET FTP Example: http://support.microsoft.com/default.aspx?scid=kb;en-us;832679 I can get the program to create directories, change directories, etc., but I can't...
6
by: obdict | last post by:
Hello, I used scanf() in a while loop, which ensures that user input is valid (must be an integer no greater than 21 or less than 3). If user enters a number out of the range, or enters...
1
by: d0ugg | last post by:
Hi all, I have a little question, my compiler is giving me the following error: error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const...
12
by: beatjunkie27 | last post by:
I am working on a class assignment called Pennies for Pay the object of the program is to receive input for number of days worked. This should be > 0 and <= 40. An example output is below and...
4
by: zion4ever | last post by:
Hello good people, Please bear with me as this is my first post and I am relative new to ASP. I do have VB6 experience. I have a form which enables users within our company to do an intranet...
3
by: smileyme74 | last post by:
Every time I enter for example 1 mile, I get the error. /** * This program will convert measurements expressed in inches, * feet, yards, or miles into each of the possible units of *...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.