July 2017
Intermediate to advanced
158 pages
3h 41m
English
This annoying mistake is found in many programs. As the heading says, these are cases where programmers call any of the group() methods without a prior call to the find, matches, or lookingAt methods. A matcher is created using the pattern.matcher(String) method call, but we need to invoke one of these three methods to perform a match operation.
If we call matcher.group() without calling one of these three methods, then the code will throw a java.lang.IllegalStateException exception, as the following code is doing:
package example.regex; import java.util.regex.*; public class MissingMethodCall { public static void main(String[] ...Read now
Unlock full access