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