Bifalgorithm post · Computer science one · Accessor & Mutator Methods
How do member methods differ from static methods?
How do member methods differ from static methods? (Computer science one · Accessor & Mutator Methods) — "In contrast to the methods we defined in Chapter 29, w…
Ideas in this flowchart
- Defining member methods in the Student class
- Unlike the methods in Chapter 29, member methods are defined without the static keyword.
- A static method or variable belongs to the class rather than to its instances.
- The example defines a public Student class with member variables.
- The member variables store the student's first name, last name, ID, and GPA.
- The class provides two public member methods that compute and return results from member variables.
- getFormattedName returns the student's name in the format Last, First.
- getGpaAsPercentage converts a GPA assumed to use a 4.0 scale into a percentage.
- Javadoc-style comments document each member method.