Java Method Stubs

A method stub in this sense is a method with no real substance, i.e. it’s not doing what it is intended to do. Your getUserNum() method should return a user’s unique ID, but instead you’re defining a stub that simply returns -1 on every invocation.

You can tell from your main() method, you’re supposed to be defining these two methods:

userNum1 = getUserNum();
avgResult = computeAvg(userNum1, userNum2);

So, define them. Here’s what the getUserNum() stub would look like.

public static int getUserNum() {
    System.out.println("FIXME: Finish getUserNum()");
    return -1;
}

I’ll leave computeAvg() up to the OP.

Leave a Comment