import java.util.regex.*;public class Demo03 {
public static void main(String[] args) {
Pattern p = Pattern.compile("(a-z){3}");
Matcher a = p.matcher("fgh");
System.out.println(a.matches());
System.out.println("fgh".matches("(a-z){3}"));
}
}为什么会输出两个false?应该是true啊?求指教。
public static void main(String[] args) {
Pattern p = Pattern.compile("(a-z){3}");
Matcher a = p.matcher("fgh");
System.out.println(a.matches());
System.out.println("fgh".matches("(a-z){3}"));
}
}为什么会输出两个false?应该是true啊?求指教。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货