Java System in

Syntax

System.in has the following syntax.

public static final InputStream in

Example

In the following code shows how to use System.in field.


//from w ww.  ja va2  s .  com
import java.io.IOException;

public class Main {

  public static void main(String[] arg) {
    System.out.println("Type something");
    try {
      System.in.read();
    } catch (IOException e) {
      e.printStackTrace();
    }
  }

}

The code above generates the following result.





















Home »
  Java Tutorial »
    java.lang »




Boolean
Byte
Character
Class
Double
Enum
Float
Integer
Long
Math
Number
Object
Package
Process
ProcessBuilder
Runnable
Runtime
SecurityManager
Short
StackTraceElement
StrictMath
String
StringBuffer
StringBuilder
System
Thread
ThreadGroup
ThreadLocal
Throwable