Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.util.Arrays;

public class Main {
    public static void main(String args[]) {
        String testStr = "This is  a test.";
        System.out.println("Original string: " + testStr);
        String result[] = testStr.split("\\s+");
        System.out.print("Split at spaces: ");
        System.out.println(Arrays.toString(result));
    }
}
/*
Original string: This is  a test.
Split at spaces: [This, is, a, test.]
*/