Exercise 2: Computing Cubes

This exercise requires you to compute cubes of variables passed

We'll cover the following

Problem Statement

Write a method void computeCubes which:

  • takes three integers num1, num2, num3 as input.
  • computes the cube of all three values.

This method is void type hence doesn’t return any values. How will you get the updated values of num1, num2 and num3?? Hmmmm…

Hint: Thinks in terms of the ​pass by reference method of passing values.




Get hands-on with 1200+ tech skills courses.