A noob question about Java Loops?

Hi guys, my name is Kaz and to be honest Im a Java Noob, Ive just study Java for less then 4 weeks, and my homework ( which worth 20% of my score) is

Hi guys, my name is Kaz and to be honest I'm a Java Noob, I've just study Java for less then 4 weeks, and my homework ( which worth 20% of my score) is driving me crazy. I've try asking other people and they would just told me it's a simple usage of loop but I tried and tried but it doesn't work at all, saying It's too easy or it's just a basic loop doesn't really help me at all, so I was wondering if anyone here could help me as specific as possible. Basically I want the program to loop and restart, asking the first question again after you answer the wrong answer or finish. Please help me, I know this maybe too easy and may not take any effort for some of you here, but for me it's a matter of learning, and I want to be good at Java, we all start low somewhere, right?

[CODE]import java.util.* ;

class Test
{
public static void main( String[] not_in_use )
{
Scanner keyboard = new Scanner( System.in ) ;


boolean quit = false;


System.out.print ("This program test if you are a liar by asking a questions\n"
+ "Press Enter to begin\n");
keyboard.nextLine();
// What I want to do is make this quesstion below restart itself by asking the user if they want to restart
if ( quit == false)// I want to retry this question
{
System.out.print ("Did you eat my cake?, Answer with Yes or No\n");
char answer = keyboard.nextLine().charAt(0);
if (( answer == 'Y')||(answer == 'y'))
{
System.out.print ("I'll Kill you cake eater\n");
quit= true;
}
if (( answer == 'N')||(answer == 'n'))
{
System.out.print ("Oh Ok\n");
}
}
if ( quit == false)
{
System.out.print ("Are you sure?, Answer with Yes or No\n");
char answer = keyboard.nextLine().charAt(0);
if (( answer == 'Y')||(answer == 'y'))
{
System.out.print ("Oh Ok, sorry that I asked\n");
quit=true;\\restart to question 1
}
if (( answer == 'N')||(answer == 'n'))
{
System.out.print ("I KILLLLAAARUUUHHHH\n");
quit=true;\\restart to question 1
}
}
if
(quit == true)
{
System.out.print ("Don't like that result? Like to answer again? Y/N");
char retry = keyboard.nextLine().charAt(0);
if (( retry == 'Y')||(retry == 'y'))
{
//This is the part where some magic would happen and restart the question, I'm stuck here

}
if (( retry == 'N')||(retry == 'n'))
{
System.out.print("Bye\n");
}
}
}[/CODE]

or:Hi guys, my name is Kaz and to be honest I'm a Java Noob, I've just study Java for less then 4 weeks, and my homework ( which worth 20% of my score) is driving me crazy. I've try asking other people and they would just told me it's a simple usage of loop but I tried and tried but it doesn't work at all, saying It's too easy or it's just a basic loop doesn't really help me at all, so I was wondering if anyone here could help me as specific as possible. Basically I want the program to loop and restart, asking the first question again after you answer the wrong answer or finish. Please help me, I know this maybe too easy and may not take any effort for some of you here, but for me it's a matter of learning, and I want to be good at Java, we all start low somewhere, right?[CODE]import java.util.* ;class Test{ public static void main( String[] not_in_use ) {\t Scanner keyboard = new Scanner( System.in ) ; boolean quit = false; System.out.print (\"This program test if you are a liar by asking a questions\\" \t\t\t\t + \"Press Enter to begin\\"); keyboard.nextLine(); // What I want to do is make this quesstion below restart itself by asking the user if they want to restart if ( quit == false)// I want to retry this question { \tSystem.out.print (\"Did you eat my cake?, Answer with Yes or No\\"); \t char answer = \tkeyboard.nextLine().charAt(0);\t\t if (( answer == 'Y')||(answer == 'y')) { \tSystem.out.print (\"I'll Kill you cake eater\\"); quit= true; }\t if (( answer == 'N')||(answer == 'n')) { \tSystem.out.print (\"Oh Ok\\"); }\t } if ( quit == false) { \tSystem.out.print (\"Are you sure?, Answer with Yes or No\\"); \t char answer = \tkeyboard.nextLine().charAt(0);\t\t if (( answer == 'Y')||(answer == 'y')) { \tSystem.out.print (\"Oh Ok, sorry that I asked\\"); quit=true;\\\estart to question 1 }\t if (( answer == 'N')||(answer == 'n')) { \tSystem.out.print (\"I KILLLLAAARUUUHHHH\\"); \tquit=true;\\\estart to question 1 }\t } if (quit == true) { \tSystem.out.print (\"Don't like that result? Like to answer again? Y/N\"); \tchar retry = keyboard.nextLine().charAt(0); if (( retry == 'Y')||(retry == 'y')) { \t//This is the part where some magic would happen and restart the question, I'm stuck here \t \t } \tif (( retry == 'N')||(retry == 'n')) \t { \t System.out.print(\"Bye\\"); \t } } }[/CODE]


or:its correct :3

Tags:score,question,