Ask Experts Questions for FREE Help !
Ask
    goldberg1337's Avatar
    goldberg1337 Posts: 1, Reputation: 1
    New Member
     
    #1

    Oct 4, 2009, 07:32 PM
    How do I get a Java program to repeat, start from beginning?
    Hey guys, this is my first post.

    I was just wondering how to code a Java program to start again from the beginning. I'm trying to do a simple if... while loop and I want to be able to get it so that unless the person enters "quit" it will start again at the beginning. I'm only just starting with Java in computer science, so if you can answer this as simply as possible it would be much appreciated!
    Perito's Avatar
    Perito Posts: 3,139, Reputation: 150
    Ultra Member
     
    #2

    Oct 4, 2009, 07:56 PM

    I don't program in Java, but in other languages, the only way to do that is to write a loop in the MAIN subroutine of the program. Something like

    do {
    ...
    } while (condtion);

    or

    while (condition)
    {
    ...
    }

    I would normally use a Boolean variable and set it to FALSE to exit the loop.

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

Java program? [ 2 Answers ]

we have an assignment! but hold up! I would only ask what is the name of this code if I have fill up the blanks! code: puclic class problim{ public static void main(Stringarg){ int x=___; int y=___; while;(__<s){ x=____;

Client server program in java [ 1 Answers ]

have a problem about writing client-server program. I want to write two (using TCP and UDP) different client and server programs which are used to transfer an ascii file. Some different information about this project is that the server will wait for client connection and when the client is...

I have had cramps since the beginning of December, am I going to start me first period [ 1 Answers ]

Hi, I have had cramps since beginning og December and I've just started getting discharge. Am I going to start my period soon?


View more questions Search