0

I can't figure out why this won't exit when quit is entered.

import java.io.*;
import java.util.*;

public class Trial
{

    static final String ADD_COMMAND = "add";
    static final String REMOVE_COMMAND = "remove";
    static final String QUIT_COMMAND = "quit";
    static final String PRINT_COMMAND = "print";
    
     // Create a single shared BufferedReader for keyboard input
        private static BufferedReader stdin = 
            new BufferedReader( new InputStreamReader( System.in ) );

        // Program execution starts here
        public static void main ( String [] args ) throws IOException
        {
            // Prompt the user
         
               System.out.print( "Type some data for the program: " );
            String input = "";
                        
            while(input != "quit")
            {

            // Read a line of text from the user.
             input = stdin.readLine();

            // Display the input back to the user.
            
            System.out.println( "input = " + input );
            
             }

         } // end main method


}
2
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by blufab
0

One question though. Are they any no no's about not using input.equals() or !input.equals() in such a thing.

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.