ArrayList is allowing me to store items to it but not call them using .get(), says it isn't an ArrayList : <p>I am writing a program to simulate a restaurant menu system using the command design pattern. I made the construtor in my Menu class initialize an arraylist.</p>

<pre><code>import java.util.ArrayList;

public class Menu {

    public ArrayList&lt;MenuItem&gt; listOfMenuItems;

    public Menu() {
        listOfMenuItems = new ArrayList&lt;MenuItem&gt;();
    }

    public void addItemToMenu(String itemName, String itemDescription, double cost) {
        MenuItem newMenuItem = new MenuItem(itemName, itemDescription, cost);
        listOfMenuItems.add(newMenuItem);
    }

    public void displayMenu() {
        for(MenuItem item : listOfMenuItems) {
            System.out.println("NAME: " + item.getItemName() + ", DESCRIPTION: " + item.getItemDescription()
                + ", COST: " + item.getItemCost());
        }
    }
}
</code></pre>

<p>When calling a new Menu in my client, it allows me to store items (as if it was an arraylist), it also allows me to implement the command design pattern and print all of my items out. However, I was adding a Tab class which used information from my Menu object, but it doesn't let me use .get() to retrieve information from my arraylist.</p>

<pre><code>import java.util.*;

public class testClient {
    public static void main(String[] args) {

        Menu menu = new Menu();
        Tab tab;

        System.out.println("MENU:");

        menu.addItemToMenu("lobster", "#1234" , 25.99);
        menu.addItemToMenu("chicken", "#5687" , 20.99);
        menu.addItemToMenu("steak", "#4567" , 21.99);

        DisplayMenu dispMenu = new DisplayMenu(menu);
        SubmitButton onPressed = new SubmitButton(dispMenu);
        onPressed.submit();

        System.out.print("\n");

        System.out.println("ORDERS:");

        Order order = new Order();
        order.addNewOrder("#1234");
        order.addNewOrder("#5678");

        SubmitOrder submitOrder = new SubmitOrder(order);
        SubmitButton onSubmitPressed = new SubmitButton(submitOrder);
        onSubmitPressed.submit();

        tab.constructTab(newMenu.get(0).getItemName(), order.get(0).getOrderItemNumber(), newMenu.get(0).getItemCost());

    }
}
</code></pre>

<p>The line tab.constructTab(....), returns the following error:</p>

<pre><code>testClient.java:31: error: cannot find symbol
        tab.constructTab(menu.get(0).getItemName(), order.get(0).getOrderItemNumber(), menu.get(0).getItemCost());
                             ^
  symbol:   method get(int)
  location: variable menu of type Menu
testClient.java:31: error: cannot find symbol
        tab.constructTab(menu.get(0).getItemName(), order.get(0).getOrderItemNumber(), menu.get(0).getItemCost());
                                                         ^
  symbol:   method get(int)
  location: variable order of type Order
testClient.java:31: error: cannot find symbol
        tab.constructTab(menu.get(0).getItemName(), order.get(0).getOrderItemNumber(), menu.get(0).getItemCost());
                                                                                           ^
  symbol:   method get(int)
  location: variable menu of type Menu
3 errors
</code></pre>

<p>it says that menu is of type Menu when it should be an arraylist? I don't understand why it allows me to add items then.</p>

<p>Please let me know if you need any additional code.</p>

<p>Thank you in advance!</p>
