Objects Class Methods
Objects Class Methods
A class:
Models an abstraction of objects
Defines the attributes and behaviors of objects
Is the blueprint that defines an object
Objects and Classes
Classes reflect concepts, objects reflect instances that
embody those concepts.
A PC may be an object
Balance MakeDesposit
InterestYTD Transfer
Owner WithDraw
Account_number GetBalance
account …
BankAccount myAccount;
myAccount = new BankAccount();
Methods
Two (2) kinds of Methods
◼ Those that return a single value
◼ Those that perform some action
Methods - Examples
public String getFname()
{
return fname;
}
14
Assignment:
Create a class Person with at least 10
properties. Provide corresponding
accessors (getters) and mutators
(setters) for each of the methods.