📄 standardconsoleio.java
字号:
// 例5.1.1 StandardConsoleIO.java
import java.io.*;
public class StandardConsoleIO
{
public static void main(String args[])
{
boolean over=false; // 判定循环结束的标志
int int_read=0; // 存放从控制台中读入的字节数量
byte b[]=new byte[1024]; //存放从控制台中读入的字节
try
{ // 必须要进行异常处理,因为即使预料到也无法避免其发生
while(!done)
{
int_read = System.in.read(b); //采用read()的第二种形式
if(int_read == -1)
over=true;
else
{
System.out.print("b = ");
System.out.write(b,0,int_read);
}
}
}catch(IOException e){
e.printStackTrace();
}
System.exit(0);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -