CSCI 211 Test 1 Flashcards
variables declared as “primitive types” ? represent information and are stored on the ?
directly; runtime stack
runtime stack
belongs to the program; keeps track of return addresses for method calls and variables that are local to a method (including method parameters)
variables declared as class types are ? to objects
“references”
objects are stored on the
runtime heap
the reference to an object is on the
runtime stack
pass by value
when calling a method, copies of the argument values are given to the method parameters
pass by references
a copy is given to the method parameters, but the copy of the reference points to the same object as the original (gives you the ability to make changes to the object)
object
a programming construct that consists of a state and set of behaviors; an instance of a class
an object’s state is described by
data members (e.g. int count, boolean full)
class
describes a set of objects of the same type (data members, methods); a blueprint that says how to build an object of that type; contains actual code
interface
a set of methods that are provided by a unit of code; java lets us declare an interface as a set of methods (doesn’t require an implementation)
Java allows us to group a collection of classes into a ?
package; just put “package packagename;” at the top of all files in the package
when application code wants to use a package
import packagename.*; (matches all classes in the package)
API (Application Programming Interface)
the set of public methods supported by the classes in the package (their interfaces) is an example
public
visible to the application
private
only accessible by class
(no access modifier)
default = package access only
protected
visible to child classes and the package
collection
a container that holds of group of objects, often called elements
the Java Collection Framework supports several types of collection:
List, Set, Maps
List
an ordered collection; order can be determined by insertion order or sometimes by the compareTo() method of the Comparable Interface or a Comparator object that’s passed to a sort() method of the collection
Set
usually no guarantee that order will be preserved; null elements are allowed; NO duplicates are allowed (they will be ignored if entered)