问题 单项选择题

在匹配器(Matcher)类中,用于寻找下一个模式匹配串的方法是

A.static boolean matches()

B.boolean marcher.find()

C.int matcher.start()

D.int matcher.end()

答案

参考答案:B

解析: 本题考查考生对Java中的匹配器(Marcher)类的理解。Marcher类用于将一个输入字符串input和模式串pattern相比较。boolean mateher,find()方法用于寻找下一个模式匹配牢:int marcher.start()方法用于返回匹配串的一个起始索引整数值;int matcher.end()方法用于返回匹配串的一个终止索引整数值。而用于输入字符串与模式串比较的方法是static boolean matches(),选项B正确。

填空题
单项选择题