title: Adding objects to list?
body: <p>I just want to make sure I'm doing the right thing. I have a subclass Account and then two subclasses SavingsAccount and CreditAccount and i want to store them in an arraylist, but when I do like this I get errors</p>
  
  <pre><code>List&lt;Account&gt; accountList = new ArrayList&lt;Account&gt;();
  // creditaccount
  Account account = new CreditAccount();
  list.add(account);
  
  // savingsaccount
  Account account = new SavingsAccount();
  list.add(account);
  </code></pre>
  
  <p>I thought I could just add them like that, but I guess there must be a unique name like this...</p>
  
  <pre><code>Account account1 = new SavingsAccount();
  list.add(account1);
  </code></pre>
  
  <p>...or am I misunderstanding it? I'm new to this, so help i preciated! Thanks!</p>