Objects, classes and more
New Terminology - Actually much of this is review
- class
- A class is a blueprint or prototype from which objects are created. A
set of objects.
- object
- An instance of a class. It contains a copy of all of the instance variables defined in the class declaration.
- member
- Attributes or methods that belong to the class or object. They are
directly contained within the class block.
- attributes (fields)
- Global variables that are the characteristics of the class.
- methods
- Behaviors or actions of the class.
- state
- The specific values of an object. (Its attribute values.)
- visibility
- Applied to class members, visibility defines the scope of the
member (public or private).
- encapsulation
- The combining of attributes and behaviors into a single package that
protect that class of objects and their data.
- instantiation
- The act of creating a new object from a class.
- qualified name
- A member name that is "qualified" by an object name or a class
name.
- accessor methods
- Methods which access data within an object but do not change the
object's state.
- mutator methods
- Methods which access data within an object and change the state of
one or more attributes.
- constructor
- Special method with the same name as the name of the class that can be used primarily to initialize class fields.
- overloaded methods
- Two methods with the same name but with different numbers and types of parameters
- aliases
- Two reference variables that reference the same object.
- call by value
- The method of parameter passage in which the value of the actual
parameter (argument) is copied into the formal parameter (recipient) in
the method. All method calls in Java are call by value. In
the case of reference types, that call by value is copying the
reference from one variable to another.
- static
- A modifier on either a field or method member of a class which
defines that member to belong to the class as a whole instead of to
instances of the class. That means that for fields, there is a
single field and value regardless of the number of objects created.
- shadowing
- The practice of having a field member in a class with the same
name as a local variable in a method of the class. The local
variable takes precedence when referred to in the method in which it is
defined. To relieve ambiguity, the keyword this is used to refer
to the instance field as in this.variable.
Java Specific Terms
- private
- The class member is visible only to its own class methods.
- public
- The class member is visible to any class's methods that chooses to
use it.
- this
- A java reserved word which refers to the calling object.
Some examples of classes from labs
Color139.java
ISPCharge.java
Grade139.java
BaseStat.java
CarStat.java