title: Assigning an object to a variable with methods in catch block
body: <p>When I try to compile my code I get error cannot find symbol for <code>.size()</code> and <code>.get(int)</code>.</p>
  
  <p>If I move the for loop outside the catch block I get a cannot find symbol error for the 
  currentUserDiary variable.</p>
  
  <p><code>getExisitingDiaries()</code> returns a <code>DiaryBook</code> so I thought this would work.</p>
  
  <p>Just wondering if there is something wrong with assigning an Object to a variable this way or if theres something wrong with the rest of my code.</p>
  
  <p>I have to use the catch block because the methods read from a text file.</p>
  
  <pre><code>AccountList aListOb = new AccountList();
  try {
      aListOb.loadExistingDiaries(myAccountName);
      DiaryBook currentUserDiary = new DiaryBook();
      currentUserDiary = aListOb.getExistingDiaries(myAccountName);
  
      for (int i = 0; i &lt; currentUserDiary.size(); i++) {
          System.out.println(currentUserDiary.get(i));
      }
  
  } catch (IOException e) {
  
  }
  </code></pre>
  
  <p>these methods are in the AccountList class:</p>
  
  <pre><code>public void loadExistingDiaries(String name) throws IOException {
      for(int i = 0; i &lt; aList.size(); i++)
      {
          if (aList.contains(new Account(name, null))) {
              aList.get(i).loadExistingDiaries();
              break;
          }
      }
  }
  
  public DiaryBook getExistingDiaries(String name) throws IOException {
      DiaryBook d = new DiaryBook();
      for(int i = 0; i &lt; aList.size(); i++)
      {
          if (aList.contains(new Account(name, null))) {
              aList.get(i).loadExistingDiaries();
              d = aList.get(i).getDiaryBook();
              break;
          }
      }
      return d;
  }
  </code></pre>