Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.io.PrintStream;

public class Main {
    /**
     * Prints a sentence to the Standard-out stream. It expect a string array with tokens.
     * 
     * Each token will be one line and after all tokens are printed there will be one empty line marking the ending of sentence.
     * 
     * @param inTokens a string array with tokens
     */
    public static void printTokens(String[] inTokens) {
        printTokens(inTokens, System.out);
    }

    /**
     * Prints a sentence to a stream. It expect a string array with tokens.
     * 
     * Each token will be one line and after all tokens are printed there will be one empty line marking the ending of sentence.
     * @param inTokens a string array with tokens
     * @param stream a print stream
     */
    public static void printTokens(String[] inTokens, PrintStream stream) {
        for (int i = 0; i < inTokens.length; i++) {
            stream.println(inTokens[i]);
        }
        stream.println();
    }
}