nullpointerexception array.length java -


i've been getting npe whenever try access array. calling .length attribute gives me npe. appreciated. here constructor , method keeps failing.

public skierlist() {     skier[] skiers= new skier[initial_cap];     (int = 0; < skiers.length;i++){         skiers[i] = new skier("");     }     int count = 0;  }  public void add(skier newskier) {        if (this.size() < skiers.length)     {         skiers[count] = new skier(newskier.getname(), newskier.getlevel());         count++;     } } 

the code compiles throws npe @ skiers.length

define skier globally:

public skier[] skiers= new skier[initial_cap]; 

Comments