Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

ATFL LAB 09 REPORT

AYESHA RIZWAN
18-SE-25
Code:
package lab09;

import java.util.Scanner;
public class Task {
public static void main(String[] args) {
String list[] = {"outlook.com","uettaxila.com"
,"live.com","gmail.com","yahoo.com"};
String s;
do {
Scanner input = new Scanner(System.in);
int match = 0;
s="";
System.out.print("\nEMAIL--VALIDATION ------------"
+ "-------\nEmail address : ");
s+=input.nextLine();
String s1[] = s.split("@");
if(s1.length==2){
for(int i=0; i<list.length;i++){
if(s1[1].equalsIgnoreCase(list[i]))
match=1;
}
}
if(match == 1){
System.out.println(" Valid Email");
}
else{
System.out.println(" valid email");
}
}while(!(s.equals("exit")));
}
}

Output:

You might also like