The Department of Computer Science & Engineering
|
|
STUART C. SHAPIRO: CSE
115 C
|
myMethod() have
been defined, all with no parameters, the version that will be
used to execute the statement
depends not on the declared type ofvar.myMethod();
var, but on the
actual type of the object that is the value of var
when the statement is executed.
..." as shown here:
accessControl ReturnType methodName(Type1 param1,
TypeLast... paramLast)
In that case, the last parameter is bound to a collection of the
values of the arguments following the required arguments. In
the method body, they can be operated on within a for each
loop. For example, the body of the above method might contain
the loop
for (TypeLast var: paramLast) {
var.someMethod();
}