I want to accept email id from the user as an attribute like other attributes like name, id etc. What is the procedure to create custom data type to accept email id from the users?
Asked
Active
Viewed 8,891 times
-3
-
1String varaible you can use to store emailid – JavaBeigner Aug 28 '14 at 08:44
-
I didn't understand your question properly. Do you want to know which datatype to save email ID (or) how to validate email address entered by user? – bhargavg Aug 28 '14 at 08:47
-
Do yoou just want to create an instance variable to store the data, or something different? – DonyorM Aug 28 '14 at 08:48
1 Answers
2
- Store e-mail in
String. - Validate it using
regex.
Ref :
http://www.regular-expressions.info/java.html
http://www.mkyong.com/regular-expressions/how-to-validate-email-address-with-regular-expression/
Community
- 1
- 1
Himanshu Tyagi
- 5,201
- 1
- 23
- 43