java - array ouput not correct -


i using 2 classes , bunch of methods store in array writing file. after write file, instead of being of var double, code:

public void storearray(quest1 a, quest2 b, string filename) throws   filenotfoundexception{  printwriter k = new printwriter(filename); for(int = 0; < a.getdays(); i++) {     k.println(b.storearr(a)); }  k.close(); system.out.println("written."); } 

quest 1 class, quest 2 class , string filename getting passed through. after doing , putting quest3 object in main menu. run program, input values etc put array in class quest 2 , write them file.

i open file check if has worked , this:

     [d@264532ba 

how fix double variables in file?

print out arrays.tostring instead of print out array (which invokes tostring inherited object):

k.println(arrays.tostring(b.storearr(a))); 

or if want custom format, can use stringutils.join apache commons. or, perhaps write loop if cannot use dependencies.

the thing output tostring of array, type ([d) + @ + hash code (264532ba).


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 -