MainClass.java Source code

Java tutorial

Introduction

Here is the source code for MainClass.java

Source

public class MainClass {

    public static void main(String[] arg) {
        String text = "to be or not to be, that is the question.";
        String[] words = text.split("[, .]", 0); // Delimiters are comma, space, or period

        for (String s : words) {
            System.out.println(s);
        }
    }

}