main.java

来自「java的经典例子」· Java 代码 · 共 20 行

JAVA
20
字号
import java.io.*;

class Main {
    public static void main(String[] args) {
        // Create a pb input stream with buf size of 10
        PushbackInputStream in = new PushbackInputStream(System.in, 10);

        byte[] buf = {'h', 'e', 'l', 'l', 'o', '\n'};
        try {
            in.unread(buf);
            int c;
            // Echo contents of pb stream to standard out.
            while ((c=in.read()) >= 0) {
                System.out.print((char)c);	// hello ...
            }
            System.out.println();
        } catch (IOException e) {}
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?