Public class Iotestnext {
Public Static void Main (string[] args) {
/*
* 1. The first way: use of Java.util.Scanner
*
Scanner sc=new Scanner (system.in);
System.out.println ("Waiting Inputchar:");
String N=sc.next ();
SYSTEM.OUT.PRINTLN (n);
*/
/*
* 2. The second way: java.io
*
InputStream input=system.in;
You can also use BufferedReader to get input
BufferedReader input=new BufferedReader (New InputStreamReader (system.in));
Byte[] B=new byte[100];
try {
Input.read (b);
} catch (IOException e) {
E.printstacktrace ();
}
String Str=new string (b);
System.out.print (str);
*/
/*
* 3. The third Way: java.io.Console;
* Description: There is no main console in eclipse, so the following methods are not available, but can be used in Windows cmd
*/
Console Console=system.console ();
if (console==null) {
SYSTEM.OUT.PRINTLN ("Cannot use the console");
Return
}
String str= console.readline ();
System.out.print (str);
*/
}
}
How to get input