Why do I get a NullPointerException, when I try to execute the method "temperaturEingeben"? I hope you can understand my code because it´s in German.
public class Temperaturanzeige{
private int[] temperatur;
public Temperaturanzeige(){
int[] temperatur=new int[24];
for(int i=0; i<temperatur.length;i++){
temperatur[i]=-100;
}
}
public void temperaturEingeben(int tempNeu,int tageszeit){
temperatur[tageszeit]=tempNeu;
}
}
Thanks for your answer!