Java Reference
In-Depth Information
completed. Understanding this model is important for overall understanding, and
you should practice executing method calls yourself, using this model. If you
cannot do it, then it is likely that you do not understand some important details
of how a program is executed!
2.9
Self-review exercises
SR1 . What is the difference between a static method and a non-static method?
SR2. A function call is an _________; a procedure call is a ____________.
SR3 . Is the following a function call or a procedure call? meth(4, 3);
SR4 . Is the following a function definition or a procedure definition?
public void method( int b) { … }
SR5 . Define parameter: _________________________________________.
SR6 . Define argument: _________________________________________.
SR7 . To figure out what a procedure call meth(a1, a2) does, we _________.
SR8 . The scope of a parameter is: __________________________.
SR9 . The scope of a local variable is: __________________________.
SR10 . A local variable keeps its value from one call of the method to the next
(true or false).
SR11 . A function call must terminate with a statement whose syntax is: _____.
SR12 . Draw a frame for the call C.meth(45, 6 + 2); on method meth of the
class shown below. Show the state just after the arguments have been assigned
to the parameters but before the method body is executed.
public class C {
public static void meth( int b, double c) {
String s;
...
}
}
Answers to Self-review exercises
SR1 . A static method is placed in the file drawer for the class in which it is
defined. A nonstatic method appears in every instance of the class in which it is
defined.
 
Search WWH ::




Custom Search