Hi,
I found this question at:
http://www.wickedlysmart.com/SCJPStudyGuide/Java_5_SCJPquestions.html and it says:
import java.util.regex.*;
class Regex2 {
public static void main(
String[] args) {
Pattern p = Pattern.compile(args[0]);
Matcher m = p.matcher(args[1]);
boolean b = false;
while(b = m.find()) {
System.out.print(m.start() + m.group());
}
}
}
And the command line:
java Regex2 "\d*" ab34ef
What is the result?
The answer is: E). 01234456
As per my understanding, I am still confused as to how the '6' is derived in the above answer?
It would be great if someone can explain.
Thanks,