0

I was just wandering if someone could help me how to redo a case statement.

After executing the program, there would be a line asking :
Try Again? YES / NO

If yes, then the program re-executes without hitting F5 again. (using JCreator pro 5).


All i have is this:

System.out.print("Tray again? (1=Yes/0=No)? ");
        int Answer = scnr.nextInt();

        if (Answer == 1)
           //DON'T KNOW WHATS NEXT HERE
        else
            //DON'T KNOW WHATS NEXT HERE

Snippet would be greatly appreciated.

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by Vaspar
0

You can do this using do while loop...

int Answer;
do{

// do you task here...

System.out.print("Tray again? (1=Yes/0=No)? ");
Answer = scnr.nextInt();
}while(Answer==1);

Edited by Vaspar: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.