This is my main class:

```
import java.util.ArrayList;
public class MainClass {
    public static void main(String[] args){
        ArrayList<SecondClass.InnerClass> list=new ArrayList<SecondClass.InnerClass>();
        list.add(new SecondClass.InnerClass()); //error here (read below)
    }
}       

```

Here is the second class:

```
public class SecondClass {
    public class InnerClass{

    }
}

```

At `MainClass`, at `list.add`, I get this error: 

> 
> No enclosing instance of type SecondClass is accessible. Must qualify
>  the allocation with an enclosing instance of type SecondClass (e.g.
>  x.new A() where x is an 
>  instance of SecondClass).
> 
> 
> 

I need to have `InnerClass` non-static because `InnerClass` needs to make a static reference to a non-static method. How can I add elements in the `ArrayList`?