The below statement returns void
Pattern lazy = Pattern.compile("X??");
Matcher lazyMatcher = lazy.matcher("X");
if (lazyMatcher.matches()) {
System.out.println(lazyMatcher.group());
}
Is there way to print void in java.
I tried below 2 statements , but does not help
System.out.println((String)lazyMatcher.group());
System.out.println(lazyMatcher.group().toString());
============================================================================= Updating
why am i getting String when i call below
System.out.println(lazyMatcher.group().getClass()) // returns string
System.out.println(lazyMatcher.group()) // returns void