title: Can't access an object's methods
body: <p>I'm very new to Java and might not see sth obvious, but here's my problem:</p>
  
  <p>For some reason I cannot access the methods of my class <code>MenuItem</code>:</p>
  
  <pre><code>public class MenuItem {
      String name;
      double price;
  
      public MenuItem (String name, double price) {
          this.name = name;
          this.price = price;
      }
      public String getName() {
          return this.name;
      }
      public String toString() {
          return this.name + "\t" + this.price;
      }
  }
  </code></pre>
  
  <p>In the following code snippet my IDE underlines the method <code>getName()</code> red and says:</p>
  
  <blockquote>
    <p>"cannot find symbol"</p>
  </blockquote>
  
  <p>This is the code:</p>
  
  <pre><code>public static void main(String[] args) {
     ArrayList&lt;Object&gt; menuItems = new ArrayList&lt;Object&gt;();
  
     menuItems.add(new MenuItem("Pizza", 2.22));
  
     System.out.println(menuItems.get(0).getName());
  }
  </code></pre>
  
  <p>I compared my code with code of other's and cannot find any difference.</p>
  
  <p>Somehow the <code>toString()</code> method works perfectly fine. It returns <code>this.name + "\t" + this.price;</code> and not <code>filechallenge.MenuItem@15db9742</code> which it does when I delete the method.</p>
  
  <p>Does anybody have an idea? I really don't get it...</p>