... then the method name getName and an empty set of parentheses because no arguments are being passed. When getName is called:

  1. The app transfers execution from the call (line 14 in main) to method getName’s declaration (lines 14–16 of Fig. 7.1). Because getName was called via the myAccount object, getName “knows” which object’s instance variable to manipulate.

  2. Next, method getName performs its task—that is, it returns the name (line 15 of Fig. 7.1). When the return statement executes, program execution continues where getName was called (line 14 in Fig. 7.2).

  3. System.out.printf displays the String returned by method getName, then the program continues executing at line 17 in main.

Get Java How To Program, Late Objects, 11th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.