使用正则表达式检查Gmail的电子邮件地址
import java.util.*; import java.util.regex.*;/**来自 时 代 J a v a - N o w J a v a . c o m**/ import java.util.Collections; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int N = in.nextInt(); String emailRegEx = ".+@gmail\\.com$"; Pattern pattern = Pattern.compile(emailRegEx); List<String> myList = new ArrayList<String>(); for(int a0 = 0; a0 < N; a0++){ String firstName = in.next(); String emailID = in.next(); /**来自 时 代 J a v a**/ Matcher matcher = pattern.matcher(emailID); if (matcher.find()){ myList.add(firstName)