Mega Code Archive

 
Categories / Java Tutorial / Development
 

The in field represents the standard input stream

You can use it to accept user keyboard input. import java.io.IOException; public class MainClass {   public static void main(String[] args) {     try {       char c = (char) System.in.read();       while (c != '\r') {         System.out.println(c);         c = (char) System.in.read();       }     } catch (IOException e) {     }   } }