Java Method Call Array -


How can I pass an array from my main method into another method? I am getting an error with the parameters. Do I use the return value from the main? And since the returns value from the main is an array, then the parameters of the main call should be placed in brackets? Should there be a price between those brackets?

  public squares arraysAndmethods {public zero printRere (double [] arr) {int x = arraysAndMethods.main (double [i] arr); // For error with the parametres (int i = 0; i & lt; studgrade lihat; i ++) system. Out.print (studreds [i] + ""); } // printArray method public static double [] main (string array []) {// double array java.util.Scanner input = new java.util.Scanner (System.in); // Input Scanner System.out.println ("What is the class size?"); Int n = input.nextInt (); Double [] arr = new double [n]; // (NI = 0; i & lt; arr.length; i ++) {// Input Grade for each student} System.out declare and start the array for many elements. Println ("What is the student's grade" + (i + 1)); Arr [i] = input.nextDouble (); } // Return loop for end arrow; } // End of the main method / end of the // class  

simply enter the name , Not type

  int x = arraysAndMethods.main (arr); Edit: Apart from that, your code shows some other problems 

  1. The main (...) is the entry point for your application. It does not seem to call the main (...) in other ways. It should be on the other side.
  2. The main (...) signature is: Public static zero main (string [] args). You can not declare it to return an array of double.

Comments

Popular posts from this blog

c# - SignalR: "Protocol error: Unknown transport." when navigating to hub -

class - Kivy: how to instantiate a dynamic classes in python -

python - mayavi mapping a discrete colorbar on a surface -