Skip to main content
- Last updated
Save as PDF
- Previously, we defined a class as a collection of related methods. Now you know that a class is also a template for a new type of object.
- A member of a class. Every object is an instance of some class.
- Create a new instance of a class in the computer’s memory.
- data encapsulation:
- A technique for bundling multiple named variables into a single object.
- instance variable:
- An attribute of an object; a non-static variable defined at the class level.
- information hiding:
- The practice of making instance variables
private to limit dependencies between classes.
- A special method that initializes the instance variables of a newly-constructed object.
- Defining a local variable or parameter with the same name and type as an instance variable.
- A class that uses objects defined in another class.
- A method that returns the value of an instance variable.
- A method that assigns a value to an instance variable.
- Replacing a default implementation of a method, such as
- instance method:
- A non-static method that has access to
this and the instance variables.
- Two values that are the same; in the case of objects, two variables that refer to the same object.
- Two objects that are “equal” but not necessarily identical, as defined by the
- pure method:
- A static method that depends only on its parameters and no other data.
- modifier method:
- A method that changes the state (instance variables) of an object.