next up previous
Next: Difference between the methods Up: Unit 02 Previous: A simple Java program

Method calls


Method call

Syntax:
object.methodName(parameters)

Semantics:

Calls a method on an object, possibly passing additional parameters. The effect of a method call is the execution of the operation associated to the method, and sometimes the return of a value.

Example:

System.out.println("Ciao!");

The call of the println() method causes the string passed as parameter, i.e., "Ciao!", to be printed on the standard output channel (the monitor), which is denoted by System.out. Notice that this method does not return any result, but performs an operation on the object (denoted by) System.out.



next up previous
Next: Difference between the methods Up: Unit 02 Previous: A simple Java program