Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    public static boolean isValidEmail(String email) {
        String tokens[] = email.split("@");
        if (tokens.length != 2 || tokens[0].length() == 0 || tokens[1].length() == 0)
            return false;
        tokens = tokens[1].split("\\.");
        if (tokens.length != 2 || tokens[0].length() == 0 || tokens[1].length() == 0)
            return false;
        return true;
    }
}