Question
Write a java method, for a given string, test whether it is a valid email address or not. Assume that a valid email address satisfying
Write a java method, for a given string, test whether it is a valid email address or not. Assume that a valid email address satisfying the following conditions:
(1) The string should contain exactly one @ symbol.
(2) The string should contain at least one dot (.) symbol.
(3) There are some letters before @, that is, @ is not the first letter of the string.
(4) There are some letters between @ and .
(5) The string ends in one of the following: .com, .edu, .gov, .org, or .us
In main method, call the above method to test whether the following strings are valid email format or not.
t2@yahoo.com a@oldwes tbury.edu c@.edu c.@ny.gov a@abc.us c@.redcross.org
firstname.lastname@abc.com.us
@abc.com
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started