Logout

D.1.10

Describe how data items can be passed to and from actions as parameters.

 

Teaching Note:

Parameters will be restricted to pass-by-value of one of the four types in D.1.6. (JSR note: probably meant to be D.1.9, not D.1.6.) Actions may return at most one data item.

 

Sample Question:

sdfsdfsf

JSR Notes:

By sending them in the parentheses that follow a method. The order and type of the parameter list must be matched.

So, for example, a method might be:


public static void aMethod(String s, int n, boolean b){ if(b){ for(int i = 0; i < n; i++){ sout(s); } else{ sout("Sorry, you sent false as the boolean variable!"); } }

If using this method, we would have to send three, and exactly three, "arguments", to be received as "parameters", and send them in exactly the following order: String, int, boolean, such as:


aMethod("Hello", 100, true);