just started java, eclipse
I want the program to contine only if 'y' or 'Y' is pressed
if any other key is pressed end program
please help
import java.io.*;
public class TicketMaster{
public static void main(String args[]) throws IOException{
char choice;
do{
choice ='\0'; //clear char
System.out.println("First Test \t\t" + choice);
//rerun program
System.out.println("Run Program Again: ");
choice = (char) System.in.read();
//testing
if(choice == 'y' || choice == 'Y')
System.out.println("Contine \t\t" + choice);
else
System.out.println("End Program \t\t" + choice);
System.out.println("\n\n\n");
}
while(choice == 'y' || choice == 'Y');
} //end main method
} //end class