title: Conditional method chaining in java
body: <p>What is the best possible way to chain methods together? In my scenario, there are <em>four</em> methods. If the output of the <em>first</em> method is <code>true</code>, it has to call the <em>second</em> method. </p>
  
  <p><strong>For Example:</strong></p>
  
  <pre><code>flag = method1();
  if (flag){
    flag = method2();
  }
  if (flag){
    method3();
  } 
  // and so on for next methods ..
  </code></pre>