Hello and thank you in advance for your time. I'm working on a homework assignment that require an input from the user in command line. If the user input the "Exit" or "Quit" My program should quit. I'm able to do one one work but not sure how to do two. ALso the my loop is not looping all time. Can someone shine some light please.
import java.io.Console;
public class Echo2{
public static void main(String [] args){
String userText = System.console().readLine("Enter some text:");
//System.out.println("*** " + userText + " ***" );
if (userText.equals("Exit")){
return;
}
else{
System.out.println("*** " + userText + " ***" );
}
}
}