Question: Help me with this, "Exception in thread "main" java.lang.NullPointerException" 
thanks

```
private List< PosibleTerreno> posibles_terrenos;
private List< PosibleTerreno> terrenos_validos;

//-------------------------------

 int cantidad = this.posibles_terrenos.size(); 

        for (int i = 0 ; i < cantidad ; i++)
        {
            if(this.posibles_terrenos.get(i).get_validez() == true)
            {
                this.terrenos_validos.add(this.posibles_terrenos.get(i));
            }
        }

```

Answer: 
You have *[declared](https://www.google.com/search?q=define%20declared%20java)* these variables

```
private List< PosibleTerreno> posibles_terrenos;
private List< PosibleTerreno> terrenos_validos;

```

but you have not *[initialized](https://www.google.com/search?q=define%20initialize%20java)* them. You need to do something along the lines of

```
private List< PosibleTerreno> posibles_terrenos = new ArrayList<PosibleTerreno>();
private List< PosibleTerreno> terrenos_validos = new ArrayList<PosibleTerreno>();

```

Otherwise, both lists are `null`, and attempting to reference any of their functions...doesn't even make sense, because there's no "their" there. They're *nothing*. So attempting this

```
int cantidad = this.posibles_terrenos.size(); 

```

will obviously result in a `NullPointerException`.

(+1 for three homophones in a row.)
You need to initialize your `List(s)`, you might use a [ArrayList](http://docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html) and/or a [LinkedList](http://docs.oracle.com/javase/7/docs/api/java/util/LinkedList.html) perhaps with - 

```
private List<PosibleTerreno> posibles_terrenos = new ArrayList<PosibleTerreno>();
private List<PosibleTerreno> terrenos_validos = new LinkedList<PosibleTerreno>();

```

With Java 7 and above, you can also use the [diamond operator](https://stackoverflow.com/q/4166966/2970947) like so -

```
private List<PosibleTerreno> posibles_terrenos = new ArrayList<>();
private List<PosibleTerreno> terrenos_validos = new LinkedList<>();

```