title: How to send multiple values using methods in Java
body: <p>I am trying to send multiple values using arrays, I am using return to send two different data types, but I know it is the wrong way of doing it. I have research but I can't find the solution for this specific problem. Any help would be appreciated. Thanks.   </p>
  
  <pre><code>import java.util.Scanner;
  
  public class methodbankinput {
      public static void main(String args[]) {
  
          Scanner kb = new Scanner(System.in); 
          String[] names = new String[2];
          int[] account_numbers = new int[2];
          String userinput = "";
          String accountosearch="";
          int count = 0;
  
          do {
                  System.out.println("Type P");
                  System.out.println("Type S");
                  System.out.println("Type E to exit");
                  userinput = kb.nextLine();
  
                  if(userinput.equals("P")) {
                     **String[] populate** = populate(names,account_numbers);
  
                  } else if(userinput.equals("S")) {
  
                  System.out.println("Please enter the accoun to search");
                  accountosearch = kb.next(); 
                  search(names,accounttosearch);
                  } 
                  count++;
             }
             while(count &gt;=0);
  } 
  
  public static String[] int[] populate(String[] names,int[] account_numbers) {   
      Scanner kb = new Scanner(System.in); 
          for (int i = 0; i &lt; names.length; i++) {
              System.out.println("Please enter 10 names");
              names[i] = kb.next();
              System.out.println("Please Enter 10 Account_numbers");
              account_numbers[i] = kb.nextInt();
          }
          return names[10],account_numbers[10];    
      }
   }    
  </code></pre>