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 isEmail(String input) {
        int atIndex = input.indexOf('@');

        if (atIndex == -1)
            return false;

        int lastDotIndex = input.lastIndexOf('.');

        return atIndex < lastDotIndex && lastDotIndex - atIndex != 1 && lastDotIndex != input.length() - 1
                && atIndex != 0;
    }
}