很有意思的问题,为什么运行没有错,调试的时候却报错!!!!
public class Groups {
static public final String POEM = "I am singing o\n" + "I am dawning o\n"
+ "I am thinking o\n";
public static void main(String[] args) {
Matcher m = Pattern.compile("(?m)(\\S+)\\s+((\\S+)\\s+(\\S+))$")
.matcher(POEM);
while (m.find()) {
for (int j = 0; j <= m.groupCount(); j++) {
System.out.print("[" + m.group(j) + "]");
}
System.out.println();
}
}
}
为什么代码运行没有错,在for循环里面设断点调试的时候却报错,或者在while处设断点就进不去while循环里面,求高手解答!!!!