java - How do i call an array from private methods? -


so, have make application creates results, have completed everything, think???? dont know how me private method outputdata output array results private method getvalue.

this have

 // createresults.java // create poll results , output them file. import java.io.filenotfoundexception; import java.util.formatter; import java.util.formatterclosedexception; import java.util.illegalformatexception; import java.util.nosuchelementexception; import java.util.scanner;  public class createresults {    private int getvalue()    {          int[]results = { 1, 1, 1, 1, 1, 2, 2, 3, 3, 4, 5, 6, 7, 8, 9 };          outputdata(results);     } // end method getvalue     private void outputdata(int[] output)     {           (int row = 0; row < results.length; row++) {          system.out.println(input [row]);    }//end    } // end method outputdata     public static void main( string args[] )    {       createresults application = new createresults();       application.outputdata();    } // end main } // end class createresults 

to code work, need make getvalue public (and not return anything, make void)

then within main can then call application.getvalue() create array , call outputdata

public void getvalue() {      int[]results = { 1, 1, 1, 1, 1, 2, 2, 3, 3, 4, 5, 6, 7, 8, 9 };      outputdata(results);  } // end method getvalue  public static void main( string args[] ) {   createresults application = new createresults();   application.getvalue (); } //  

also outputdata working on inputted parameter of output need change to

 private void outputdata(int[] output)   {       (int row = 0; row < output.length; row++) {          system.out.println(output[row]);      }  }//e