Glossary
Every term is defined in the words the course and exam description (CED) uses, tagged with the units it appears in, and linked to the lesson that teaches it.
2
- 2D array
An array of arrays that stores related data in rows and columns; each element is reached with arr[row][col].
A
- Abstraction
Reducing complexity by focusing on the main idea: hiding details that do not matter for the question at hand and grouping the useful ones.
- Access modifier
The keywords public and private, which control whether classes, data, constructors and methods can be used from outside the declaring class.
- Accessor method
A non-void method that lets objects of other classes obtain a copy of the value of an instance variable or class variable.
- Algorithm
A step-by-step process for completing a task or solving a problem, written in words or drawn as a diagram such as a flowchart.
- Aliasing
Two or more references that refer to the same object, so a change made through one reference is seen through the others.
- Anatomy of a class
The parts of a Java class: the class header, instance variables, constructors and methods, each with its access modifier.
- Application programming interface (API)
An API specification is documentation that tells programmers how to use the classes in a library: their attributes and behaviors.
- Argument
A value passed into a method or constructor when it is called.
- Arithmetic operators
The five operators for arithmetic: + (addition), - (subtraction), * (multiplication), / (division) and % (remainder).
- ArithmeticException
The exception thrown when a program tries to divide an integer by the integer zero.
- Array
An object that stores a fixed number of values of the same type, either primitive values or object references, reached by an index.
- Array length
The number of elements in an array, set when the array is created and read with the length attribute (no parentheses).
- ArrayIndexOutOfBoundsException
The run-time exception thrown when code uses an array index less than 0 or greater than or equal to the array's length.
- ArrayList
A java.util class for a list of object references that can grow and shrink; ArrayList<E> names the element type E.
- ArrayList methods
The Java Quick Reference ArrayList methods: size, add(obj), add(index, obj), get, set and remove; add and remove at an index shift later elements.
- Assignment statement
A statement that uses = to store the value of the expression on the right in the variable on the left.
- Attribute
Data related to a class, stored in variables, such as a plant's name and height.
- Autoboxing
The automatic conversion the compiler makes from a primitive value to its wrapper class object, such as int to Integer or double to Double.
B
- Base case
The condition in a recursive method where it returns without calling itself again, which halts the recursion.
- Behavior
What instances of a class can do, or what can be done with them, defined by methods, such as grow or getHeight.
- Bias in data
Bias that comes from how data is collected or used; algorithmic bias is systemic, repeated errors in a program that create unfair outcomes for a specific group.
- Binary search
A search algorithm for sorted data that checks the middle element and eliminates half of the remaining elements each step.
- Block
Any section of code enclosed in braces { }.
- boolean
The primitive type whose only values are true and false.
- Boolean expression
An expression that evaluates to a Boolean value, true or false, such as a comparison with a relational operator or a combination with logical operators.
C
- Call by value
The way Java passes arguments: each parameter is initialized with a copy of the argument.
- Call stack
The list Java keeps of method calls that have started but not yet returned, each with its own parameters and local variables.
- Casting
Converting a value between double and int with the casting operators (int) and (double).
- Class
The formal implementation, or blueprint, of the attributes and behaviors of an object. A class defines a reference type.
- Class method
A method associated with the class, not with instances of the class. Its header includes the keyword static.
- Class variable
An attribute declared with the keyword static that belongs to the class, so all objects of the class share a single copy.
- Column-major order
A 2D array traversal that moves down each column, top to bottom, before moving to the next column.
- Comment
Text in code written for programmers and ignored by the compiler. Java has //, /* */ and /** */ comments.
- compareTo
The String method compareTo(String other): negative if this comes first alphabetically, 0 if equal, positive if this comes later.
- Compiler
A program that checks code for some errors before it can run. Errors the compiler finds must be fixed first.
- Compound assignment operator
One of +=, -=, *=, /= and %=: it does the arithmetic with the variable and the right side, then stores the result in the variable.
- ConcurrentModificationException
The run-time exception that can be thrown when an ArrayList changes size while an enhanced for loop is traversing it.
- Constructor
Code in a class that is called to create an object. It has the same name as the class and sets the object's initial attribute values.
- Constructor signature
The constructor's name (the class name) plus the ordered list of parameter types, such as Plant(String, int).
D
- Data abstraction
Separating the abstract properties of a data type from the concrete details of how it is represented, by giving data a name.
- Data set
A collection of specific pieces of information or data, such as a week of temperatures or a list of scores.
- Data type
A set of values and a corresponding set of operations on those values. Every data type is primitive or reference.
- De Morgan's laws
Rules that create equivalent Boolean expressions: !(a && b) is equivalent to !a || !b, and !(a || b) is equivalent to !a && !b.
- Default constructor
The no-parameter constructor Java provides when a class has no constructor written; it sets instance variables to default values.
- Dot operator
The . used to call a method on an object (p.grow(5)) or a class method with the class name (Math.abs(-3)).
- double
The primitive type for real numbers, such as 3.75 or -0.5.
- Double (class)
The java.lang wrapper class whose immutable objects hold one double value; Double.parseDouble(s) returns a String as a double.
E
- Element
One value stored in an array or an ArrayList, at a position given by its index.
- Encapsulation
Keeping the implementation details of a class hidden from other classes, mainly by making instance variables private.
- Enhanced for loop
A loop that assigns a copy of each element of an array or ArrayList, in order, to its loop variable, without using an index.
- equals
The String method equals(Object other), which returns true if both strings have the same sequence of characters.
- Equivalent Boolean expressions
Two Boolean expressions that evaluate to the same value in all cases. A truth table can prove they are equivalent.
- Escape sequence
A special sequence of characters in a string that starts with a backslash: \" (double quote), \\ (backslash) or \n (newline).
- Exception
A run-time error caused by an unexpected problem the compiler did not detect. It interrupts the normal flow of execution.
- Expression
Code that is evaluated to a single value with a type. An arithmetic expression combines numeric values, variables and operators.
F
- File (class)
The java.io class whose constructor File(String str) connects a program to the file with that pathname so a Scanner can read it.
- final
A keyword that makes a variable's value unchangeable once it has been set.
- for loop
An iterative statement whose header has three parts: the initialization (runs once), the Boolean expression (checked before each iteration) and the update (after each iteration).
I
- if statement
A selection statement that runs its body only when its Boolean expression is true, changing the flow of control.
- if-else statement
A two-way selection: the if body runs when the Boolean expression is true, and the else body runs when it is false. Exactly one of them runs.
- Immutable
Cannot be changed once created. String objects are immutable: their methods return new strings and never change the original.
- Inclusive and exclusive
Describes an endpoint of a range: inclusive means the value can occur, exclusive means it cannot.
- Increment and decrement operators
The post-increment operator ++ adds 1 to a numeric variable and the post-decrement operator -- subtracts 1.
- Index
The position of a character in a String, counted from 0. Valid indices run from 0 to length() - 1.
- indexOf
The String method indexOf(String str), which returns the index of the first occurrence of str, or -1 if str is not found.
- IndexOutOfBoundsException
The run-time exception thrown when an ArrayList method gets an index outside its valid range, such as get(size()).
- Infinite loop
A loop whose Boolean expression always evaluates to true, so it never stops. It compiles; it is a logic error.
- Informal run-time analysis
Comparing how efficient code segments are by comparing their statement execution counts, found by tracing the iterative statements.
- Inheritance
The relationship from subclasses to a superclass: subclasses draw on the superclass's attributes and behaviors without replacing them.
- Initialization
Giving a variable its first value. A variable must be initialized before it is used in an expression.
- Insertion sort
An iterative sort that inserts each next element into the sorted portion by shifting larger elements right.
- Instance
An object created from a class. "An instance of Plant" means a Plant object.
- Instance method
A method called on an object of the class, using the object's name and the dot operator.
- Instance variable
An attribute declared in a class outside any method or constructor, whose value is unique to each object of the class.
- Instantiation
Creating an object (an instance) of a class with new and a constructor call.
- int
The primitive type for integers, such as -4, 0 or 120. An int is stored in 4 bytes.
- Integer (class)
The java.lang wrapper class whose immutable objects hold one int value; Integer.parseInt(s) returns a String as an int.
- Integer division
Dividing two int values: the result is only the integer part of the quotient, so 7 / 2 is 3.
- Integer overflow
What happens when an int expression would go outside the range Integer.MIN_VALUE to Integer.MAX_VALUE: the result is an int in range, but not the expected value.
- Integrated development environment (IDE)
A program that gives a programmer tools to write, compile and run code in one place.
- Intellectual property
Creations of the mind, such as program code, that belong to their authors; reusing code raises legal and licensing questions.
- IOException
The java.io exception class for input and output problems; adding throws IOException to a method header handles a file that cannot be opened.
J
- Javadoc comment
A comment that starts with /** and ends with */, used to create API documentation.
L
- length()
The String method that returns the number of characters in a String.
- Library
A collection of classes that programmers can use instead of writing everything themselves.
- Linear search
A search algorithm that checks each element in order until it finds the desired value or has checked every element.
- Literal
The code representation of a fixed value, such as 42, 3.5, true or "hi".
- Local variable
A variable declared in the header or body of a block of code, including a method or constructor parameter, usable only in that block.
- Logic error
A mistake in the algorithm or program that makes it behave incorrectly or unexpectedly. Testing with specific data detects it.
- Logical operators
The operators ! (not), && (and) and || (or), which combine Boolean expressions into a compound Boolean expression. Precedence: !, then &&, then ||.
- Loop control variable
The variable that controls how many times a loop runs. In a for loop it is the variable set up by the initialization in the header.
M
- Math class
A class in java.lang that contains only class methods for common calculations, such as abs, pow, sqrt and random.
- Math.random
A Math class method that returns a double greater than or equal to 0.0 and less than 1.0.
- Merge sort
A recursive sort that divides an array into one-element subarrays, then merges sorted subarrays back together in order.
- Method
A named block of code that only runs when it is called.
- Method decomposition
Breaking a large behavior of a class into smaller behaviors, with one method for each smaller behavior.
- Method overriding
When a public method in a subclass has the same signature as a public method in its superclass but its own behavior.
- Method signature
The method name plus the ordered list of parameter types, such as pow(double, double). With no parameters: the name and an empty list.
- Multiway selection
An if-else-if chain that runs at most one segment of code: the one for the first expression that evaluates to true, or the trailing else if none is true.
- Mutator method
A method that changes the values of instance variables or class variables; it is often a void method.
N
- Nested if statement
An if, if-else or if-else-if statement inside the body of another one. The inner Boolean expression is evaluated only if the outer one is true.
- Nested iteration
A loop inside the body of another loop. The inner loop completes all its iterations before the outer loop continues to its next iteration.
- new
The keyword that creates an object. It is followed by a call to one of the class's constructors.
- Non-void method
A method that returns a value of its return type. The value must be stored in a variable or used in an expression.
- null
A special literal meaning a reference variable is not associated with any object.
- NullPointerException
The exception thrown when a method is called on a null reference.
O
- Object
A specific instance of a class with defined attributes.
- Object class
The class at the top of every Java class hierarchy: all classes are subclasses of Object.
- Object reference
The value a reference variable holds: it can be thought of as the memory address of the object.
- Off by one error
An error in which a loop runs one time too many or one time too few, often from < versus <= or a wrong starting value.
- Open source
Code that its authors publish for others to use, study and reuse, under a license that states the conditions.
- Operator precedence
The rules that decide how operators are grouped: *, / and % before + and -, same level left to right, parentheses first.
- Overloading
Having several methods (or constructors) with the same name but different signatures.
P
- Package
A group of related classes in an API or library, such as java.lang, which holds String and Math.
- Parameter
A variable declared in the header of a method or constructor. It receives the value passed in and can be used in the body.
- Passing references
When an argument is an object reference, the parameter gets a copy of the reference, so both refer to the same object.
- Postcondition
A condition that must always be true after a method runs, describing what is returned or the values of the object's attributes.
- Precondition
A condition that must be true just before a method runs for it to behave as expected. The method is not expected to check it.
- Primitive type
A data type for numbers and Boolean values whose variables hold the value directly. In this course: int, double and boolean.
- Procedural abstraction
Giving a process a name (a method) so it can be used by knowing what it does, not how it does it.
- Program design
Planning a program's classes, with each class's attributes and behaviors, in natural language or a diagram before writing code.
R
- Recursion
A form of repetition in which a method calls itself; it needs at least one base case and at least one recursive call.
- Recursive call
A call in which a method calls itself, usually with parameter values that move closer to the base case.
- Reference equality (== versus equals)
Using == or != on object references checks whether they refer to the same object. A class's equals method checks whether two objects are equivalent.
- Reference type
A data type used to define objects, that is, anything that is not a primitive type. Every class defines a reference type.
- Relational operators
The operators ==, !=, <, >, <= and >=, which compare two values and evaluate to a Boolean value.
- Remainder operator (%)
The % operator: a % b gives the remainder when a is divided by b.
- Repetition
An algorithm building block in which a process repeats itself until a desired outcome is reached. In Java, iteration is a form of repetition.
- Return statement
A statement that sends the flow of control back to the caller, and in a non-void method sends back a value compatible with the return type.
- Return type
The type of value a method sends back, written before the method name in the header, or void if it returns nothing.
- Round-off error
An error that occurs when a double result is more precise than can be stored, so the value is rounded to a representable one.
- Row-major order
A 2D array traversal that moves across each row, left to right, before going down to the next row.
- Run-time error
A mistake that occurs while the program is running. It typically makes the program stop abnormally.
S
- Scanner (file input)
The java.util class that reads data from a file: Scanner(File f) with nextInt, nextDouble, nextBoolean, next, nextLine, hasNext and close.
- Scope
The part of a program where a variable can be used, set by the block in which the variable is declared.
- Selection
An algorithm building block in which a true or false decision chooses how the execution of the algorithm proceeds.
- Selection sort
An iterative sort that repeatedly selects the smallest (or largest) unsorted element and swaps it into its final position.
- Sequencing
The order in which the steps of an algorithm are completed: one at a time, in a set order.
- Short-circuit evaluation
When the first operand of && or || already decides the result, the second Boolean expression is not evaluated.
- State (of an object)
An object's attributes and their values at a given time, stored in the object's instance variables.
- Statement execution count
The number of times a statement is executed by a program, usually calculated informally by tracing and analyzing the loops.
- String
A class whose objects hold a sequence of characters. String is a reference type in java.lang, and String objects are immutable.
- String concatenation
Joining strings with + or +=, which creates a new String. Primitives are converted to text and objects call toString.
- String literal
A sequence of characters enclosed in double quotes, such as "Game over".
- String traversal
Visiting the characters or substrings of a string one position at a time with a loop, usually with substring(i, i + 1).
- StringIndexOutOfBoundsException
The exception thrown when a String method uses an index outside the allowed range.
- substring
String methods substring(from, to), which returns the characters from index from to to - 1, and substring(from), which goes to the end.
- Superclass and subclass
A superclass holds attributes and behaviors common to related classes; subclasses extend it and draw on them without rewriting.
- Syntax error
A mistake where the rules of the programming language are not followed. The compiler detects it.
- System reliability
A program's ability to perform its tasks as expected under stated conditions without failure.
T
- Text file
Storage for data, as readable text, that persists when the program is not running and can be read while the program runs.
- this
A special variable inside an instance method or constructor that holds a reference to the current object, the object whose method or constructor is running.
- toString
A method that returns a String representing an object; println and string concatenation call it automatically.
- Traversal
Using repetition (or recursion) to access all elements of an array or ArrayList, or an ordered sequence of them.
- Truncation
Cutting off the digits to the right of the decimal point, as (int) does when it casts a double to an int.
- Truth table
A table that lists every combination of true and false for the variables in Boolean expressions, with the value of each expression in every row.
U
- Unboxing
The automatic conversion the compiler makes from a wrapper class object to its primitive value, such as Integer to int or Double to double.
V
- Variable
A named storage location that holds a value, which can change while the program runs. Every variable has a name and a data type.
- void method
A method that does not return a value, so it is not called as part of an expression.
W
- while loop
An iterative statement that evaluates its Boolean expression before each iteration, including the first, and repeats its body while the expression is true.
- Widening
The automatic conversion of an int value to a double value, such as when an int is stored in a double variable.
- Wrapper class
A class whose objects hold one primitive value; for the AP® exam, Integer wraps an int and Double wraps a double.
No terms match. Try a shorter word, or choose All.