title: android/java concept to call all getter methods with a single loop
body: <p>I am doing an assignment and stuck at this point:
  I have a class in which i have 30 getter and setter method. </p>
  
  <pre><code>  public class example{
  
  public String get1(){
   return someString1;
  }
  
  public String get2(){
  return someString1;
  }
  
  public String get3(){
  return someString4;
  }
  
  and so on...
  
  public String get30(){
  return someString30;
  }
  
  }
  </code></pre>
  
  <p>Now i want to call all getter method with a single loop like</p>
  
  <pre><code>for(int i= 1; i&lt;=30;i++){
  // String total = get1()+get2()+get3()...............
  }
  </code></pre>
  
  <p>what should i do?</p>
  
  <p><strong>Edit:</strong> i did it using reflection :</p>
  
  <p><a href="http://docs.oracle.com/javase/tutorial/reflect/member/methodInvocation.html" rel="nofollow">http://docs.oracle.com/javase/tutorial/reflect/member/methodInvocation.html</a></p>
  
  <p><strong>Thanks Ricky</strong></p>