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]
2 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]2 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
By default, the windows desktop display
MrRissso [65]
By default, the windows desktop display the following icons/programs

1. Your Recycle Bin
2. My Computer
3. The Internet Explorer
4. The default Windows Background
5. Your windows menu
6. My Documents
7. Your task bar
8. Time (located at bottom right)
6 0
3 years ago
True/False: Each individual element of an array can be accessed by the array name and an element number, called a subscript. Tru
Dahasolnce [82]

Answer:

True

Explanation:

3 0
2 years ago
Mary needs to choose the menu in order to place the text in a desired fashion around the image.
n200080 [17]
Can you be more specific?

7 0
3 years ago
Read 2 more answers
If the computer you are using is a laptop that moves from one network to another, you can click the _____ tab and configure stat
Leni [432]
If the computer you are using is a laptop that moves from one network to another, you can click the Alternate Configuration tab and configure a static IP address setting for a second network.
4 0
3 years ago
What activities are the most likely to infect your computer with a virus? Check all that apply
Alex17521 [72]
Opening unfamiler emails and visiting unknown websites
4 0
3 years ago
Read 2 more answers
Other questions:
  • Name any extension of MS word.
    8·2 answers
  • Match each vocabulary word to its definition.
    11·2 answers
  • Differences between electromechanical era and electronic era in point.<br>PLZ HELP​
    6·1 answer
  • Tom Daniels, an employee of a telecommunications company, is developing software that would enable customers to activate value-a
    7·1 answer
  • True or false? Resistors regulate and limit electrical current. A. True B. False
    7·2 answers
  • Complete the implementation of the following methods:__init__hasNext()next()getFirstToken()getNextToken()nextChar()skipWhiteSpac
    11·1 answer
  • 41. All the following software are examples of operating systems EXCEPT
    5·1 answer
  • What is the difference between skew and rotate in the MS Paint application?
    14·2 answers
  • Software piracy is acceptable as it helps us obtain software cheaper or sometimes even for free.
    11·2 answers
  • How is video compression accomplished?
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!