/**************************************************************************
 * Use the Console class to read from keyboard, and print to screen
 *************************************************************************/
import java.io.Console;

public class IOconsole 
{
    public static void main(String[] args)
    {
        Console cons = System.console();                            //Get access to the Console object
						
		String input = " ";
		
		while (! input.equals(""))
		{			
		    System.out.print("Enter Something: ");                  //Console does not have a print() or println()
			input = cons.readLine();                                //Read from the keyboard						
		    cons.printf("%s \n",input);                             //print to screen
		}

		System.out.print("Finally, Enter Something (no echo): ");   //Console does not have a print() or println()
		char[ ] c = cons.readPassword();                            //Read from the keyboard without echoing 			
		input = new String(c);                                      //convert char[] to a String
		cons.printf("%s \n",input);                                 //print to screen
    }
}