Cat.java


Below is the syntax highlighted version of Cat.java from §3.1 Using Data Types.


/*************************************************************************
 *  Compilation:  javac Cat.java
 *  Execution:    java Cat file1.txt file2.txt
 *  Dependencies: In.java
 *
 *  Reads in text files file1.txt and file2.txt, concatenates them,
 *  and prints the result to standard output.
 *
 *************************************************************************/

public class Cat { 

    public static void main(String[] args) { 
        In in0 = new In(args[0]);
        In in1 = new In(args[1]);
        String s0 = in0.readAll();
        String s1 = in1.readAll();
        System.out.println(s0);
        System.out.println(s1);
    }

}


Last updated: Thu Sep 30 15:35:08 EDT 2004 .
Copyright © 2004, Robert Sedgewick and Kevin Wayne.