Invocation
To invoke an instance method you first need an instance of the class.
You then write .
followed by the name of the instance method and a list of arguments.1
class Elmo {
void talkAboutRocko() {
System.out.println("ROCKO'S NOT ALIVE!!")
}
}
void main() {
Elmo elmo = new Elmo();
elmo.talkAboutRocko();
}
1
Daily reminder that Elmo absolutely hates Rocko