COP2253 Zybooks Chapter Seven Flashcards
object
a grouping of data (variables) and operations that can be performed on that data (methods)
abstraction (or information hiding or excapsulation)
means to have a user interact with an item at a high-level, with lower-level internal details hidden from the user
ADT
abstract data type
class
defines a new type that can group data and methods to form an object
public member methods
indicate all operations a class user can perform on the object
creating an object consists of two steps:
declaring a reference variable of the class type, and assigning the variable with an explicitly allocated instance of the class type
new operator
explicitly allocates an object of he specified class type
member access operator
”.” used to invoke a method on an object
private fields
variables that member methods can access but class users cannot
class members
collectively, a class’ fields and methods
method definition
provides an access modifier, return type, name, arguments, and the method’s statements
mutator (setter)
method may modify a class’ fields
accessor (getter)
method accesses but may not modify a class’ fields
constructor
a special class member that is called when an object of that class type is created and which can be used to initialize all fields (has the same name as the class and has NO return type)
default constructor
a constructor called without any arguments
border cases
unusual or extreme test case values like 0, negative numbers, or large numbers
regression testing
to retest an item like a class anytime that item is changed (if previously-passed test cases fail, the item has regressed)
reference
a variable type that refers to an object
implicit parameter
the object reference before the method name
this.
keyword used to access an implicitly passed object reference
primitive type
variable directly stores the data for that variable type
reference type
variable can refer to an instance of a class (object)
wrapper classes
built-in reference types that augment the primitive types
autoboxing
the automatic conversion of primitive types to the corresponding wrapper classes
unboxing
the automatic conversion of wrapper class objects to the corresponding primitive types
static field (or class variable)
a field of the class instead of a field of each class object
static member method
a class method that is independent of class objects
package
a grouping of related types, classes, interfaces, and subpackage
fully qualified name
the concatenation of the package name with the class name using a period
import statement
imports a package member into a file to enable use of the package member directly, without having to use the package member’s fully qualified name
wildcard character
- imports all members of a package