title: Conflict between passing an Array from Main Class to Function, but also wanting to use return vales from my "getter" method
body: <p>In my main class, I have a static method which I pass the array into. It is a static method because if I want to pass something from the main class body to this method, it must be static. In a separate class I have a series of getters and setters (which must be non static ).</p>
  
  <p>How can I pass my static array in and use the non-static getters and setters?</p>
  
  <p>EDIT- In the arraySearch method...I cannot pass in the Person Array and access the getters in the Person Class </p>
  
  <p>public class Main {</p>
  
  <pre><code>public static void main(String[] args) {
      Person One = new Person("Alice","Foo", 22, false);
      Person Two = new Person("Alice", "Foo",22, false);
      Person Three = new Person("Bob","Bar",99, false);
      Person Four = new Person("Joe","Blogs",64, false);
      Person Five = new Person("Jane", "Joe",42, false);
  
      Person [] People = {One,Two,Three,Four,Five};
      printArray(People);
  
  }
  
  public static void printArray(Person [] People)
  {
      for(int i=0;i&lt;People.length;i++)
      {
          System.out.println(People[i]);
      }
  }
  
  
  public void arraySearch(Person [] People)
  {
      for(int i=0;i&lt;People.length;i++)                                //Searches the Array of Objects
      {
          String firstName = Person.getFirstName();
          String secondName=Person.getSecondName();
          if((firstName.equals("Joe")&amp;&amp;secondName.equals("B" +        //Searches for Joe Blogs and Jane Joe
                  "logs"))|| ((firstName.equals("Ja" +
                          "ne")&amp;&amp;secondName.equals("Joe"))))
          {
              int age=Person.getAge();
              Person.setAge(age+1);                                   //Increments Age by 1
          }
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>public class Person {</p>
  
  <pre><code>private String mfirstName;
  private  String msecondName;
  private  int mage;
  private boolean misRetired;
  
  public Person(String firstName,String secondName,int age, boolean isRetired)
  {
      mfirstName=firstName;
      msecondName=secondName;
      mage=age;
      misRetired=isRetired;
  }
  
  //GETTERS 
  
  public  String getFirstName()
  {
      return mfirstName;
  }
  public  String getSecondName()
  {
      return msecondName;
  }
  public  int getAge()
  {
      return mage;
  }
  public  boolean getRetired()
  {
      return misRetired;
  }
  
  //SETTERS
  
  public  void setFirstName(String firstName)
  {
      mfirstName=firstName;
  }
  public  void setSecondName(String secondName)
  {
      msecondName=secondName;
  }
  public  void setAge(int age)
  {
      mage=age;
  }
  public  void setRetired(boolean isRetired)
  {
      misRetired=isRetired;
  }
  
  //STRING
  
  public String toString()
  {
      return (mfirstName+"-"+msecondName+"-"+mage+"-"+misRetired);
  }
  </code></pre>
  
  <p>}</p>