StreamTokenizerExample.java Source code

Java tutorial

Introduction

Here is the source code for StreamTokenizerExample.java

Source

import java.io.FileReader;
import java.io.Reader;
import java.io.StreamTokenizer;

public class StreamTokenizerExample {
    public static void main(String[] args) throws Exception {

        Reader r = new FileReader("in.txt");
        StreamTokenizer st = new StreamTokenizer(r);
        while (st.nextToken() != StreamTokenizer.TT_EOF) {
            System.out.println(st.sval);
        }
        r.close();
    }
}