I 
		
				
			
		iome89
Gast
Kann mir jemand sagen warum der Quelltext so nicht geht?
Die Syntax ist korrekt, jedoch kommt es in Zeile 19 zu einer Null Pointer Exception:
	
	
	
	
	
		
	
			
			Die Syntax ist korrekt, jedoch kommt es in Zeile 19 zu einer Null Pointer Exception:
		Code:
	
	import java.util.*;
public class Test2{
  ArrayList[] tabelle = new ArrayList[3];
  Test2(){
    tabelleFuellen();
    tabelleAusgeben();
  }
  public static void main(String[] args){
    new Test2();
  }
  public void tabelleFuellen(){
    for(int i=0;i<3;i++){
      for(int j=0; j<11;j++){
        switch(i){
          case 0:  tabelle[i].add(j);
          break;
          case 1:  tabelle[i].add(j*2);
          break;
          case 2:  tabelle[i].add((int)(Math.pow((double)(j), (double)(2))));
          break;
        }
      }
    }
  }
  public void tabelleAusgeben(){
    for(int i=0;i<3;i++){
      switch(i){
        case 0:  System.out.println("Die Zahlen von 0 bis 10:\n");
        break;
        case 1:  System.out.println("Die Zahlen von 0 bis 10 MAL 2:\n");
        break;
        case 2:  System.out.println("Die Zahlen von 0 bis 10 ZUM QUADRAT:\n");
        break;
      }
      for(int j=0; j<11;j++){
        System.out.println("["+j+"] "+tabelle[i].get(j));
      }
      System.out.println("\n");
    }
  }
} 
				 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		