Classes Flashcards
An object that belongs to a particular class is called an _________ of that class. The process of creating an object is called ________
instance, instantiation
“Garbage collection” definition
objects that are no longer accessible in the program (no longer referred to by any variable) are automatically destroyed and the memory they occupy is recycled.
Public fields + methods:
accessible ANYWHERE in all your code
Private field + methods:
accessible ONLY within constructors and methods of the same class
A requirement on the AP exam is to make ALL instance variables ______
private
Encapsulation definition:
The concept of private fields and methods hiding the implementation details of a class from other classes, its clients.
A _____ class uses your class through constructors and public methods.
client
“Information Hiding” definition:
the practice of supplying as little information to client classes as possible. For example, if a method is used only internally within that class, it should be made PRIVATE
Since all instance variables are private, they are not directly accessible in client classes. It is common to provide special public methods, called ________, that return the values of instance variables.
accessors
Modifier definition
A public method that sets a new value of an instance variable is called a modifier