Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {

        StringTokenizer st = new StringTokenizer("tutorial from java2s.com");

        // counting tokens
        System.out.println("Total tokens : " + st.countTokens());

        // checking tokens
        while (st.hasMoreTokens()) {
            System.out.println("Next token : " + st.nextToken());
        }
    }
}