java - Save data into ArrayList of other class -


i have class define array list , getter method array list:

private arraylist<double> abc = new arraylist<double>();  public void setabc(arraylist<double> abc) {     this.abc = abc; } 

in class try save data array list method:

private void test() {      abcclass x = new abcclass();      arraylist<abcclass> list = new arraylist<abcclass>();     arraylist.add(3.14);     arraylist.add(5.22);      x.setabc(list); } 

whenever try this, prompted with:

exception in thread "javafx application thread" java.lang.runtimeexception: java.lang.reflect.invocationtargetexception .... caused by: java.lang.nullpointerexception 

arraylist.add(3.14); should list.add(3.14) name gave variable initialized in line before (i.e. arraylist<abcclass> list = new arraylist<abcclass>();)


Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -