keyboard.java
来自「航班订座系统~java的作业」· Java 代码 · 共 104 行
JAVA
104 行
// read a text file and match certain items on separate lines
import java.io.*;
class Keyboard
{
InputStreamReader inStream;
BufferedReader stdInStream;
// override implicit constructor to open the input stream and attach it
// to a stream reader
Keyboard()
{
inStream = new InputStreamReader(System.in);
stdInStream = new BufferedReader(inStream);
}
// get one character
char getChar(String str)
{
char aChar = ' ';
System.out.println(str);
try
{
aChar = (char)stdInStream.read();
}
// empty exception handling
catch (Exception e)
{
}
return aChar;
} // end of getChar()
// get a whole line and return it as a String
String getString(String str2)
{
String aString = " ";
System.out.println(str2);
try
{
aString = (String)stdInStream.readLine();
}
// empty exception handling
catch (Exception e)
{
}
return aString;
} // end of getString()
} // end of Keyboard class
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?