java - Having trouble with adding an ArrayList to an ArrayList of ArrayLists -


public class tabel {     private static int dimension;      private arraylist<arraylist<character>> tabel;       public tabel(int dimension) {          tabel.dimension = dimension;          (int i=0;i<tabel.dimension*tabel.dimension;i++) {            tabel.add(new arraylist<character>());         }       } } 

when try debug (eclipse ide) lot of weird "errors" or @ least encounter consider unexpected.

the private static int not appear in "variables" section of debug.

i nullpointerexception on tabel.add(...) when watch debug, enters for once, not add in table because when hit "next" instead of jumping closing braces jumps out of function.

if comment .add works that's problem (i think). syntax wrong ? or should post more code ?

tabel not initialized, null.

change

private arraylist<arraylist<character>> tabel; 

to

private arraylist<arraylist<character>> tabel = new arraylist<arraylist<character>>(); 

or better:

private list<arraylist<character>> tabel = new arraylist<arraylist<character>>(); 

since not tie tabel arraylist.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -