Now that we've got the method skeleton and inventory, we'll
fill in a return
statement that actually computes the right
answer. This will normally be an expression that uses the parameters
from the inventory. For example, if we had the skeleton and inventory
public static int cube (int num) { // num an int }we would fill in the body and get
public static int cube (int num) { // num an int return num*num*num ; }
From the skeleton and inventory
public static String howOld (String name, int age) { // name a String // age an integer }we would fill in
public static String howOld (String name, int age) { // name a String // age an integer return name + " is " + age + " years old." ; }
The body is the most difficult and creative step in the recipe. We've tried to make it easier by moving most of the mechanical stuff into earlier steps, so by the time you get to this step, there's often not much to do.