Pattern p=Pattern.compile(".*");
Matcher m=p.matcher("abc123");
上述代码中的xxx x = xxx.xxx()如何理解?是一种获得对象的方式吗?
Pattern p=Pattern.compile(".*");
Matcher m=p.matcher("abc123");
上述代码中的xxx x = xxx.xxx()如何理解?是一种获得对象的方式吗?
class Pattern {
public static Pattern compile(String value) {
Pattern pattern = new Pattern();
....
return pattern;
}
public Matcher matcher(String value) {
Matcher matcher = new Matcher();
....
return matcher;
}
}
在此基础上,成功调用以下代码:
Pattern p=Pattern.compile(".*");
Matcher m=p.matcher("abc123");
8 回答6.5k 阅读
4 回答709 阅读✓ 已解决
2 回答3.4k 阅读
3 回答1.9k 阅读✓ 已解决
1 回答2.2k 阅读✓ 已解决
1 回答2.1k 阅读✓ 已解决
2 回答1.4k 阅读✓ 已解决