I have a nested ArrayList

```
ArrayList<ArrayList<MenuItem>> MenuList = ArrayList<ArrayList<MenuItem>>()

```

MenuItem is my class containing the item name and task(int). I'm using a few buttons to iterate through my Menu, and when I press the "enter" key I'd like to access the currently selected MenuItem.

The code is as following;

```
// enter button pressed
if(buttonStateEnter != lastButtonStateEnter){
   // changes
   // get current menu
   ArrayList currentMenuList = MenuList.get(currentMenu);

   // get menuItem obj
   Object test = currentMenuList.get(0);

   System.out.println(test.getClass());

   // get the task (int)
   //int changeTask = subNest.getTask();

   lastButtonStateEnter = buttonStateEnter;
   redraw = true;
}

```

I want to create MenuItem test rather than Object test, because I cannot access my methods this way. test.getClass() returns Class MenuItem. Putting MenuItem test in code compiles with the error

```
java.lang.Object cannot be converted to MenuItem

```