Java System.in read console

Description

Java System.in read console

import java.io.IOException;

public class Main {
  public static void main(String[] args) throws IOException {

    System.out.println("Please type a message and press enter: ");

    // Display whatever user types in
    int c = '\n';
    while ((c = System.in.read()) != '\n') {
      System.out.print((char) c);
    }// ww w.ja  v  a 2s .c o  m
  }
}



PreviousNext

Related