Check out example codes for "how to test for legit email in java". It will help you in understanding the concepts better.

Code Example 1

// Java program to check if an email address 
// is valid using Regex. 
import java.util.regex.Matcher; 
import java.util.regex.Pattern; 
class Test 
    public static boolean isValid(String email) 
        String emailRegex = "^[a-zA-Z0-9_+&*-]+(?:\\."+ 
                            "[a-zA-Z0-9_+&*-]+)*@" + 
                            "(?:[a-zA-Z0-9-]+\\.)+[a-z" + 
        Pattern pat = Pattern.compile(emailRegex); 
        if (email == null) 
            return false; 
        return pat.matcher(email).matches(); 
    /* driver function to check */
    public static void main(String[] args) 
        String email = "[email protected]"; 
        if (isValid(email)) 

Learn ReactJs, React Native from