title: indexOf() String Class Java
body: <p>I need help with comparing an <code>indexOf</code> from a string with an array of strings and display the correct matches.</p>
  
  <pre><code>public static void printvehicleMAKE(ServiceAppointment[] services, Scanner input){
  
      System.out.print("Enter vehicle make: ");
  
      String make = input.next();
      String model = make.substring(0,3);
  
      System.out.println(model);
  
      boolean flag = false;
  
      System.out.println("Details of all vehicles manufactured by " +make+" : ");
      for (int i=0;i&lt;6;i++) {
          if(model.equalsIgnoreCase(services[i].getvehicleMAKEMODEL())){
              System.out.printf("\n%10s%15s%20s", services[i].getregoNUMBER(),
                      services[i].getbuildYEAR(), services[i].getvehicleMAKEMODEL());
              flag = true;
              }
  
      }
  
      if(flag==false)
          System.out.print("No service appointments were found for vehicles " 
                  + "made by " + make);   
  }
  </code></pre>
  
  <p>Example. If I enter "toyota" or "aston", I want it to compare the 1st/2nd character of the string and return the matches from the array of strings.</p>