Solved

Java "while" loop

Posted on 1998-03-23
2
182 Views
Last Modified: 2010-04-16
I am working on a project for class and I need to construct a "while" statement.  My program accepts two numbers from the user and I need a way to allow them to enter another pair of numbers if they choose (using a "while" statement).  How can I use a "while" loop to perform some kind of "Do you want to try again, y or n" action?
0
Comment
Question by:regent
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 4

Accepted Solution

by:
rafistern earned 100 total points
ID: 1233733
Try this

String answer="no";

while(answer.equals("no"))
{
[Input two numbers]

[Do you want to try again? This will involve entering a new value for 'answer']
}

The bits in [] are the code you have to write.

Rafi
0
 

Author Comment

by:regent
ID: 1233734
Rafi,

I really appreciate your help.

Thomas
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
tomcat administrtor 12 68
hibernate example for saving data 19 77
eclipse buid path vs tomcat lib path 10 38
going to wrong jsp page 2 50
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
In this post we will learn different types of Android Layout and some basics of an Android App.
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This video teaches viewers about errors in exception handling.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question