In which sequence are the lines of the Cubes.java program in Section 5.2 executed, starting with the

Question:

In which sequence are the lines of the Cubes.java program in Section 5.2 executed, starting with the first line of main?

section 5.2/Cubes.java
1  
/**
2  
   This program computes the volumes of two cubes.
3  
*/
4  
public class Cubes
5  
{
6  
   public static void main(String[] args)
7  
   {
8  
      double result1 = cubeVolume(2);
9  
      double result2 = cubeVolume(10);
10  
      System.out.println("A cube with side length 2 has volume " + result1);
11  
      System.out.println("A cube with side length 10 has volume " + result2);
12  
   }
13  
14  
   /**
15  
      Computes the volume of a cube.
16  
     @param sideLength the side length of the cube
17  
     @return the volume
18  
   */
19  
   public static double cubeVolume(double sideLength)
20  
   {
21  
      double volume = sideLength * sideLength * sideLength;
22  
      return volume;
23  
   }
24  
}
Program Run

A cube with side length 2 has volume 8

A cube with side length 10 has volume 1000

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: