How do I validate an email address?
An address should have a "@ " and end ".com "
Here's the code I used:
public void email(){
String a = "qwertyuiopasdfghjklzxcqwertyuiopasdfghjklzxcvbnmvbnmqwertyuiopasdfghjklzxcvbnm@qwertyuiopasdfghjklzxcvbnmqwertyuiopaqwertyuiopasdfghjklzxcvbnmsdfghjklzxcvbnm.com";
String b = JOptionPane.showInputDialog("Enter email");
try{
if(!b.contains(a)){
throw new Error("Incorrect");
}else{
System.out.println("Correct");
}
} catch (Error e){
System.out.println(""+e);
}
}