SysReader Sample Use
/*
Trivial application that tests SysReader class
*/
public class TrivialApplication {
public static void main(String args[]) {
SysReader sysIn = new SysReader();
System.out.print("Type a character: ");
char ch = sysIn.readChar();
System.out.println("You typed: <" + ch + ">.");
// Eat the <Return>
// sysIn.skip(1); // one way
sysIn.readLine(); // more general way
System.out.print("Enter an integer: ");
int i = sysIn.readInt();
System.out.println("The number is: " + i);
System.out.print("Enter a float: ");
double z = sysIn.readDouble();
System.out.println("The number is: " + z);
}
}
/* Sample run of the above
Type a character: u
You typed: <u>.
Enter an integer: 23
The number is: 23
Enter a float: 45.64
The number is: 45.64
*/