Program to display contents of more than two files using SequenceInputStream.
import java.io.*;
import java.util.*;
public class SequenceInputStreamTest {
public static void main(String[] args) throws Exception {
FileInputStream fis1 = new FileInputStream("test1.txt");
FileInputStream fis2 = new FileInputStream("test2.txt");
FileInputStream fis3 = new FileInputStream("test3.txt");
Vector<InputStream> inputStreams = new Vector<InputStream>();
inputStreams.add(fis1);
inputStreams.add(fis2);
inputStreams.add(fis3);
Enumeration<InputStream> enu = inputStreams.elements();
SequenceInputStream sis = new SequenceInputStream(enu);
int ch;
while ((ch = sis.read()) != -1) {
System.out.print((char)ch);
}