title: Java storing method into arraylist
body: <p>Currently I am storing method of page into array. But I want to store these method into arraylist but not sure what is wrong with it. </p>
  
  <pre><code>WizardPage[] pages={pageone(), pagetwo(), pagethree()};
  </code></pre>
  
  <p>versus</p>
  
  <pre><code>List&lt;WizardPage&gt; pageStore = new ArrayList&lt;WizardPage&gt;();
  
  pageStore.add(pageone());
  pageStore.add(pagetwo());
  pageStore.add(pagethree());
  
  public WizardPage pageone() {
  
              WizardPage pageone = new WizardPage("one","page 1");
  
              Do something~
  
             return pageone;
  
         }
  
  public WizardPage pagetwo() {
  
              WizardPage pageone = new WizardPage("two","page 2");
  
              Do something~
  
             return pagetwo;
  
         }
  
  public WizardPage pagethree() {
  
              WizardPage pageone = new WizardPage("three","page 3");
  
              Do something~
  
             return pagethree;
  
         }
  </code></pre>