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[] argv) throws Exception {
        String testStr = "J J@H.com";
        System.out.println("Original string: " + testStr);
        String[] result = testStr.split("[\\W && [^.@]]+");
        System.out.println(Arrays.toString(result));
    }
}
/*Original string: J J@H.com
[J, J@H.com]
*/