title: Call method from another class into loop inside calling class
body: <p>I have a class <code>X</code> where I have methods <code>A</code> and <code>B</code>.</p>
  
  <p>I have a class <code>Y</code> where I have loop as below</p>
  
  <p>Is it ideal to call method inside another class inside for loop or is there any ideal way of doing this? please help.</p>
  
  <pre><code>public class X {
      public void A() {
      }
      public void B() {
      }
  }
  
  public Class Y {
      public void C() {
  
          for(int i=0; i&lt;0; i++) {
              new ClassX.A()
              .B();
          }
      }
  }
  </code></pre>