title: How to do method chaining in Java? o.m1().m2().m3().m4()
body: <p>I've seen in many Java code notation that after a method we call another, here is an example.</p>
  
  <pre><code>Toast.makeText(text).setGravity(Gravity.TOP, 0, 0).setView(layout).show();
  </code></pre>
  
  <p>As you see after calling <code>makeText</code> on the return we call <code>setGravity</code> and so far</p>
  
  <p>How can I do this with my own classes? Do I have to do anything special?</p>