1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
yan [13]
3 years ago
8

how do you call the squares method to compute the first five squares and store the result in an array numbers

Computers and Technology
1 answer:
IRINA_888 [86]3 years ago
8 0

Answer:

The method can be called using:

int[] returnarray = Squares();

<em>Where returnarray represents the name of the array</em>

Explanation:

To answer this, I will make an assumption that the Square method is an int array method (i.e. it returns array).

So, to call the method from main, an array has to be declared to get the values:

int[] returnarray = Squares();

Then an iteration is created to iterate through the array in order to print the array elements.

for (int i = 0; i < returnarray.length; i++)

 System.out.print(returnarray[i]+ " ");    

-------------------------------------------------------------------------------------------

The answer ends here

-------------------------------------------------------------------------------------------

As an addition, the complete program that includes the method and the main is:

<em>public class Main{</em>

<em> public static int [] Squares(){</em>

<em>     int [] arr = new int[5]; </em>

<em>     for(int i = 1;i<6;i++){</em>

<em>         arr[i-1] = i*i;</em>

<em>     }</em>

<em>     return arr;</em>

<em> }</em>

<em> public static void main(String[] args) {</em>

<em>  int[] returnarray = Squares();</em>

<em>  for (int i = 0; i < returnarray.length; i++)</em>

<em>  System.out.print(returnarray[i]+ " ");          </em>

<em> }  </em>

<em>}</em>

You might be interested in
A malicious actor is preparing a script to run with an excel spreadsheet as soon as the target opens the file. the script includ
professor190 [17]

Thay is the malicious actor accomplishing this task is done by using the VBA code.

<h3>What is The Visual Basic button?</h3>

It opens the Visual Basic Editor, in which you create and edit VBA code. Another button at the Developer tab in Word and Excel is the Record Macro button, which robotically generates VBA code that could reproduce the moves which you carry out withinside the application.

To run VBA withinside the “Microsoft Visual Basic for Applications” window, you could simply press “F5” key button or click on the “Run” icon withinside the toolbar.

Read more about the spreadsheet :

brainly.com/question/26919847

#SPJ1

5 0
2 years ago
Jason works as an accountant in a department store. He needs to keep a daily record of all the invoices issued by the store. Whi
kotykmax [81]

Are there any options

3 0
4 years ago
Read 2 more answers
BUURTAIS
Alisiya [41]

Answer:

what I'm confused ???????

Explanation:

?

4 0
3 years ago
I will give Brainliest and Extra points for correct answers!!!
AlexFokin [52]
Autauga Alabama 55,869
Baldwin Alabama 223,234
Barbour Alabama 24,686
3 0
3 years ago
Read 2 more answers
Using an array, double each of the following values and print each result: values = [1.1, 10, 4.55, 30004, 0.2]
11111nata11111 [884]
Values = [1.1, 10, 4.55, 30004, 0.2]
3 0
4 years ago
Other questions:
  • All digital images are made up from varying rectangles of color, called _____________.
    6·2 answers
  • Place the steps in order to keep a graphic from spilling over into the next page and to include the text it is assciated with.
    12·1 answer
  • PLEASE HELP FAST !!!!!!!!!!
    12·1 answer
  • A solid understanding of __________ is the foundation of verbal communication
    7·1 answer
  • An administrator is helping a user connect a smartphone to a tablet via Bluetooth. What should the administrator do first?
    6·1 answer
  • A thermostat with the processor program to control temperature is an example of what kind of computer
    6·1 answer
  • Ian kno da answer tell me
    7·2 answers
  • Using existing algorithms as building blocks for new algorithms has all the following benefits EXCEPT
    12·1 answer
  • What subject did this person struggle in, "I ain't never gonna nead to no this stuff."
    11·1 answer
  • What are three ways of verifying legitimate right of access to a computer system?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!