variables - using objects inside methods -


i absolute beginner. low i barely know correct wording ask question or search answer. such easy question answer im going stupid, here goes.

i have main class app , child class team. have somehow managed create football table watching lots of videos. have made 20 objects in array called team[i]. can save file , read program on load up. problem have want put saving data part of program method can called via user input.

the problem cant work out object team no longer recognised inside method. error giving me is"team cannot resolved variable". im wondering why , how can around this.

the code part stuck this, inside of main in app class. again, works fine when not in method. please, go easy on me.

static void save() { try {

        file outfile = new file("save.dat");         fileoutputstream fileoutputstream = new fileoutputstream(outfile);         objectoutputstream objectwrite = new objectoutputstream(fileoutputstream);          (i = 0; < tempdata.length; i++) {              objectwrite.writeobject(team[i]);             objectwrite.flush();             if (i == 20) {                 objectwrite.close();             }         }          system.out.println("done writing data");     } catch (ioexception e) {          e.printstacktrace();     }   }     

thank you.


Comments

Popular posts from this blog

Sort a complex associative array in PHP -

vb.net - How to ignore if a cell is empty nothing -

recursion - Can every recursive algorithm be improved with dynamic programming? -