CS111: Slides for Prof. Steinberg ʼ s lecture 2 Lecture 13 Arguments Arguments • Zero or more pieces of data can go to a static method when it is called • Each argument is an expression in the call foo( x+23 ) • If 2 or more, separate by , foo(4, x+23, “foo”) • Even if 0 arguments still need parens foo( )

CS111: Slides for Prof. Steinberg ʼ s lecture 3 Lecture 13 To Do a Call To Do a Call • Compute values of arguments • Find code for method • Create invocation record for called method • Initialize parameters of called method using argument values

This preview
has intentionally blurred sections.
Sign up to view the full version.

CS111: Slides for Prof. Steinberg ʼ s lecture 4 Lecture 13 Invocation Record Invocation Record • Memory reserved for info needed by a given call (invocation) of a method – Where are we in the code – Parameter values – Other variables as they are declared – Other information

CS111: Slides for Prof. Steinberg ʼ s lecture 6 Lecture 13 Return Value Return Value • Zero or one piece of data can come back from a static method when it returns • If zero (a void method), the call acts as a statement, I.e. has no value • If one, the call acts as an expression, I.e.

This is the end of the preview. Sign up
to
access the rest of the document.