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 回答6k 阅读
1 回答4.1k 阅读✓ 已解决
3 回答2.3k 阅读✓ 已解决
2 回答3.2k 阅读
2 回答3.9k 阅读
1 回答2.2k 阅读✓ 已解决
3 回答1.6k 阅读✓ 已解决