Two Main Method Base Method Search Matchergroup Return Array Main Method Want Iterate Sent Q37259690

I have two main method. The base() method will searchmatcher.group() and return in array. in main method I want toIterate that sent from the base() method. However, when I doIterate in main method I only printout “John Writes”. I supposed toprintout all that start by John – which they are “JohnWrites”,”John Doe”, “John Mayne”. I would apperciate any help.

public class calculate {
  
   public static void main(String[] args) {

       for(String x:calculate.base()){
          System.out.println(x);
       }
   }
   public static String[] base() {

   String text =
   “John writes about this, and John Doe writes aboutthat and John Wayne writes about everything.”;
  
   String

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.