cat.java

来自「JAVA 工作指南 可以说是程序员必备的东西哦」· Java 代码 · 共 47 行

JAVA
47
字号
import java.io.*;public class Cat {    public static void concatenate(String fileName) {        RandomAccessFile raf = null;        String line = null;        try {            raf = new RandomAccessFile(fileName, "r");            while ((line = raf.readLine()) != null) {                System.out.println(line);            }            return;        } catch(FileNotFoundException fnf) {            System.err.println("File: " + fileName + " not found.");        } catch(Exception e) {            System.err.println(e.toString());        } finally {            if (raf != null) {                try {                    raf.close();                } catch(IOException io) {                }            }        }            }    public static void main(String[] args) {        for (int i = 0; i < args.length; i++)             Cat.concatenate(args[i]);    }}

⌨️ 快捷键说明

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