1/325
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
2D array
An array of arrays in Java used to represent tabular data with rows and columns; each element is accessed using two indices: arr[row][col].
Example: "To represent a seating chart for a classroom with 5 rows and 6 columns, a programmer might declare int[][] seats = new int[5][6]; and access the seat in the third row, second column as seats[2][1]."
2D array dimensions
For a 2D array arr, arr.length gives the number of rows, and arr[0].length gives the number of columns in each row.
Example: "When writing a method to print a multiplication table stored as a 2D array table, the outer loop condition uses table.length for the number of rows, and the inner loop condition uses table[0].length for the number of columns."
@param tag
A Javadoc tag used in method documentation to describe a parameter; the format is @param paramName description.
Example: "In the Javadoc comment above a calculateArea method, the developer writes @param radius the radius of the circle in centimeters to document the meaning of the parameter before the method signature."
@return tag
A Javadoc tag used in method documentation to describe the return value of a non-void method.
Example: "Above the method public double getAverage(int[] scores), the Javadoc comment includes @return the arithmetic mean of all values in the scores array to describe what the method sends back to the caller."
Absolute value
The magnitude of a number without its sign; always non-negative. In Java, computed using Math.abs().
Example: "To compute the distance between two points on a number line, the programmer writes int distance = Math.abs(pointA - pointB);, which ensures the result is always non-negative regardless of the order of subtraction."
Abstract class
A class declared with the abstract keyword that cannot be instantiated; it may contain abstract methods without a body that must be implemented by concrete subclasses.
Example: "The class Shape is declared abstract because every shape has an area, but the formula differs per shape, so Shape defines public abstract double getArea(); and leaves it to Circle and Rectangle to provide concrete implementations."
Abstract method
A method declared with the abstract keyword in an abstract class that has no implementation; subclasses must provide a concrete implementation.
Example: "In the abstract class Animal, the method public abstract String makeSound(); forces every concrete subclass such as Dog and Cat to supply its own implementation, ensuring that calling makeSound() on any Animal reference always produces a meaningful result."
Abstraction
The process of focusing on essential characteristics while hiding unnecessary details; in OOP, abstraction is achieved through classes and interfaces.
Example: "When designing a BankAccount class, the programmer uses by exposing only deposit(), withdraw(), and getBalance() methods to callers, hiding the internal bookkeeping of how the balance is maintained."
Access modifier
A keyword that specifies the visibility of a class, method, or variable; the main access modifiers in Java are public, private, and protected.
Example: "Declaring an instance variable private int balance; inside a BankAccount class ensures that code outside the class cannot directly read or modify the balance, enforcing data integrity."
Accessor method
A public method that returns the value of a private instance variable without modifying it; also called a getter method.
Example: "The method public String getName() { return name; } is an that allows other classes to read the private name field of a Student object without exposing the field directly."
Accumulator
A variable used in a loop to collect or aggregate values as the loop iterates; commonly used to compute sums, products, or counts.
Example: "In a loop that sums all elements of an int[] array, the variable int total = 0; declared before the loop serves as the , growing with each iteration via total += arr[i];."
Accumulator pattern
A common programming pattern where a variable is initialized before a loop and then updated on each iteration to collect a running total, maximum, minimum, or concatenated result.
Example: "To find the highest score in an array, the initializes int max = scores[0]; before the loop, then updates max = Math.max(max, scores[i]); on each iteration to track the running maximum."
Actual parameter
The value or expression passed to a method when it is called; also called an argument.
Example: "In the call Math.pow(2, 10), the values 2 and 10 are the passed to the pow method, which maps them onto the formal parameters base and exponent."
Actual parameter list
The arguments specified in a particular method call.
Example: "When calling printStudentInfo("Alice", 95, true), the consists of the string "Alice", the integer 95, and the boolean true, in that order, matching the method's formal parameter types."
Algorithm
A step-by-step process or set of rules to be followed in calculations or problem-solving operations, especially by a computer.
Example: "Selection sort is an that repeatedly finds the minimum element from the unsorted portion of an array and swaps it into its correct position, eventually producing a fully sorted array."
Algorithm efficiency
A measure of the computational resources required by an algorithm; typically expressed as time complexity using Big O notation.
Example: "When choosing between linear search and binary search for a sorted array of one million elements, is critical: linear search is O(n) and may examine all million elements, while binary search is O(log n) and needs at most about 20 comparisons."
Aliasing
A situation where two reference variables point to the same object; modifying the object through one reference affects what is seen through the other.
Example: "After executing int[] b = a;, both a and b refer to the same array object, so calling b[0] = 99; also changes what is seen through a[0]—a classic situation that can cause subtle bugs."
API
Application Programming Interface; a specification of how a programmer interacts with a library's classes and methods, typically documented using Javadoc.
Example: "The Java String specifies that substring(int beginIndex, int endIndex) returns a new string from beginIndex up to but not including endIndex, so developers know how to use the method without reading its source code."
API documentation
Formal documentation of a class's public interface describing the purpose, parameters, and return values of each method; typically generated using Javadoc.
Example: "Before using the ArrayList class, a student consults the to discover that remove(int index) shifts all subsequent elements left, which explains why removing elements inside a forward-iterating index loop requires special care."
Argument
The actual value passed to a method when it is called; the argument is assigned to the corresponding parameter in the method definition.
Example: "In the method call circle.setRadius(5.0), the double literal 5.0 is the whose value is copied into the formal parameter radius inside the setRadius method."
Arithmetic expression
A combination of numeric literals, variables, and arithmetic operators that evaluates to a numeric value.
Example: "The (length * width) / 2 combines the variables length and width with multiplication and division operators to compute the area of a triangle."
Array
A data structure that stores a fixed-size, ordered collection of elements of the same type; each element is accessed using an integer index starting at 0.
Example: "Declaring int[] grades = new int[30]; creates an that holds exactly 30 integer values, each initialized to 0, with indices ranging from 0 to 29."
Array algorithm
A standard procedure applied to array data, such as finding the minimum or maximum value, computing a sum, or counting elements that match a condition.
Example: "A standard to count how many elements exceed a threshold traverses the array with a for loop, increments a counter whenever arr[i] > threshold, and returns the counter after the loop."
Array element
An individual value stored at a specific position in an array; accessed using bracket notation with its index (e.g., arr[2]).
Example: "After declaring String[] days = {"Mon", "Tue", "Wed", "Thu", "Fri"};, the days[2] holds the value "Wed", the third element in the array."
Array initialization
Setting up an array in memory either with default values (new int[5]) or with specific values using an initializer list ({1, 2, 3, 4, 5}).
Example: "The declaration double[] prices = {1.99, 3.49, 0.75}; uses an initializer list to immediately populate the array with three specific values, eliminating the need for separate assignment statements."
Array length
The number of elements in an array, accessed via the .length property; for an array arr, arr.length gives the total number of elements.
Example: "A method that reverses an array constructs the mirrored index with arr.length - 1 - i, relying on the length property to avoid hardcoding the array size and make the method work for any array."
Array of objects
An array whose elements are object references rather than primitive values; each element can be null or refer to an object of the declared type.
Example: "Declaring Student[] roster = new Student[25]; creates an array of 25 Student references, all initially null; each element must be assigned a new Student(...) object before it can be used."
Array vs ArrayList
Arrays have fixed size and use bracket syntax for access; ArrayLists are resizable and use method calls (get(), add(), remove()); arrays can hold primitives, ArrayLists cannot directly.
Example: "When the number of student records is fixed at 30, an int[] array is appropriate; but when students can be added or dropped throughout the semester, an ArrayList<Student> is preferable because it resizes automatically."
ArrayIndexOutOfBoundsException
A runtime exception thrown when a program attempts to access an array element using an index that is negative or greater than or equal to the array's length.
Example: "Using arr[arr.length] instead of arr[arr.length - 1] to access the last element will throw an <u> </u> at runtime because valid indices only go up to arr.length - 1."
ArrayList
A resizable array implementation in Java from the java.util package that can grow and shrink dynamically; stores objects (not primitives) and provides methods like add(), remove(), get(), and size().
Example: "To maintain a list of students that can grow as new students enroll, a programmer declares <u> </u><String> students = new <u> </u><>(); and uses students.add("Maria") to append each new name."
ArrayList of objects
An ArrayList parameterized with a class type that stores references to objects of that type; requires autoboxing for primitive values.
Example: "An ArrayList<Rectangle> stores Rectangle objects by reference, so when a Rectangle's setWidth() method is called through the list, the change is reflected in the actual object stored in the list."
ArrayList.add()
A method that appends an element to the end of an ArrayList, or inserts an element at a specified index shifting subsequent elements right.
Example: "Calling list.add(0, "first") inserts the string "first" at index 0 of the ArrayList, shifting every existing element one position to the right and increasing the list's size by one."
ArrayList.get()
A method that returns the element at a specified index in an ArrayList without removing it.
Example: "To print the middle element of an ArrayList<Integer> named nums, a programmer writes System.out.println(nums.get(nums.size() / 2));, using get() to retrieve the element at the computed index."
ArrayList.remove()
A method that removes an element from an ArrayList either by index or by object value; subsequent elements shift left to fill the gap.
Example: "When traversing an ArrayList with an index-based loop and calling list.remove(i), the programmer must decrement i afterward because all subsequent elements shift left, or the next element will be skipped."
ArrayList.set()
A method that replaces the element at a specified index in an ArrayList with a new value and returns the old element.
Example: "To replace the highest score in an ArrayList<Integer> at position maxIndex with a corrected value, the programmer calls scores.set(maxIndex, correctedScore), which returns the old value and stores the new one."
ArrayList.size()
A method that returns the number of elements currently stored in an ArrayList; unlike arrays, this changes as elements are added or removed.
Example: "The condition i < list.size() in a while loop ensures the loop terminates correctly even if elements are removed during iteration, because size() reflects the current number of elements after each removal."
Assignment statement
A statement that stores a value into a variable using the assignment operator (=), evaluating the right side and storing the result in the variable on the left.
Example: "The statement total = total + currentValue; is an assignment that evaluates the right-hand expression and stores the updated sum back into the variable total."
Autoboxing
Java's automatic conversion of a primitive type to its corresponding wrapper class object when needed; for example, an int is automatically converted to an Integer when added to an ArrayList.
Example: "When a programmer writes ArrayList<Integer> list = new ArrayList<>(); and then calls list.add(42);, Java automatically autoboxes the primitive int value 42 into an Integer object before adding it to the list."
Base case
The condition in a recursive method that stops further recursive calls and returns a result directly without making another recursive call; prevents infinite recursion.
Example: "In a recursive method that computes the factorial of n, the if (n == 0) return 1; terminates the chain of recursive calls so the method does not recurse infinitely."
Big O notation
A mathematical notation used to describe the worst-case time complexity of an algorithm as a function of input size n; common complexities are O(1), O(log n), O(n), O(n log n), and O(n squared).
Example: "Bubble sort compares adjacent pairs and repeats for every element, performing roughly n squared comparisons in the worst case, so its time complexity is described as O(n squared) in ."
Binary search
A search algorithm that works on sorted arrays by repeatedly dividing the search interval in half; much more efficient than linear search with O(log n) time complexity but requires sorted data.
Example: "Because requires sorted data, a programmer first sorts the array with a sorting algorithm, then applies to locate a target value in O(log n) time rather than examining every element as linear search would."
Block
A sequence of statements enclosed in curly braces { } that is treated as a single unit; used in method bodies, if statements, and loops.
Example: "The body of an if statement enclosed in curly braces { int temp = a; a = b; b = temp; } forms a that swaps two variables, and the variable temp is local to that ."
Boolean
A primitive data type in Java that stores only two values: true or false.
Example: "The variable <u> </u> isPassing = (score >= 60); stores true if the student's score is at least 60 and false otherwise, making it easy to use in conditional logic later."
Boolean algebra
The mathematical rules governing operations on boolean values (true and false), including AND, OR, NOT, and equivalence laws like De Morgan's laws.
Example: "Applying De Morgan's law from , a programmer simplifies !(isRaining && isCold) to !isRaining || !isCold, making the condition easier to read and reason about."
Boolean condition
A condition that evaluates to true or false, used to control the flow of if statements and loops.
Example: "The count > 0 && sum / count > threshold in an if statement guards against division by zero while also checking whether the average exceeds the threshold."
Boolean expression
An expression that evaluates to either true or false; used as conditions in if statements, loops, and other control structures.
Example: "The (x >= 0) && (x < arr.length) evaluates to true only when x is a valid index for the array, and is commonly used to validate indices before accessing array elements."
Boolean flag
A boolean variable used to track whether a condition has been met or an event has occurred during a loop or algorithm.
Example: "A programmer uses a boolean found = false; before a search loop, sets it to true inside the loop when a match is discovered, and checks the flag after the loop to decide what to print."
Boundary condition
A special case at the edge of an algorithm's domain, such as an empty array, a single-element array, or the first or last index; these often require special handling.
Example: "When testing a binary search implementation, a programmer must verify such as searching for a value in a single-element array, searching for the first element, and searching for the last element."
Bytecode
Platform-independent code generated by the Java compiler that can be executed by the Java Virtual Machine (JVM) on any operating system.
Example: "After the Java compiler translates HelloWorld.java into HelloWorld.class, the resulting can be executed by the JVM on Windows, macOS, or Linux without recompilation, demonstrating Java's platform independence."
Call stack
A data structure that tracks active method calls in a program; each recursive call adds a new stack frame, and the stack unwinds as each call returns.
Example: "When fibonacci(4) calls fibonacci(3), which calls fibonacci(2), each invocation is pushed onto the as a new frame; once the base cases return, the stack unwinds and each pending call receives its result."
CamelCase
A naming convention in Java where compound words are written with each word capitalized except the first; used for variable and method names (e.g., myVariableName).
Example: "Following Java's convention, a method that calculates compound interest is named calculateCompoundInterest() rather than calculatecompoundinterest() or calculate_compound_interest()."
Casting
Explicit conversion from one data type to another.
Example: "To perform true division instead of integer division, the programmer writes double average = (double) totalScore / numStudents;, totalScore to a double before the division so the decimal portion is retained."
Catch
A Java programming language keyword used to declare a block of statements to be executed in the event that a Java exception, or run time error, occurs in a preceding "try" block.
Example: "In a try- block, the <u> </u> (ArrayIndexOutOfBoundsException e) clause handles the case where user input provides an invalid array index, preventing the program from crashing and printing a helpful error message instead."
Chained method calls
Calling multiple methods in sequence by using the return value of one method call as the object on which to call the next method; for example, str.substring(1).toUpperCase().
Example: "The expression sentence.trim().toLowerCase().replace(" ", "_") uses to first remove leading and trailing spaces, then convert to lowercase, and finally replace spaces with underscores, all in one readable line."
Character processing
Operations that work with individual characters in a string, often obtained using charAt() and then tested or modified.
Example: "To count the number of vowels in a string, a method iterates through each character using str.charAt(i) and checks whether it equals 'a', 'e', 'i', 'o', or 'u', incrementing a counter on each match."
Class
A blueprint or template that defines the attributes (instance variables) and behaviors (methods) shared by all objects of that type.
Example: "The Dog defines instance variables name and breed along with methods bark() and fetch(), serving as a blueprint from which individual Dog objects like myDog and neighborsDog are created."
Class body
The content of a class enclosed in curly braces, containing the class's instance variables, constructors, and method definitions.
Example: "The of Circle contains the private instance variable double radius, a constructor that sets radius, and public methods getArea() and getCircumference(), all enclosed within the outer curly braces."
Class definition
The code that specifies the structure of a class, including its instance variables, constructors, and methods; serves as the blueprint for creating objects.
Example: "The for Rectangle specifies two private double fields length and width, a constructor to initialize them, and methods getArea() and getPerimeter() that compute and return the corresponding values."
Class header
The first line of a class definition that specifies the class's access modifier, name, and optionally what it extends or implements.
Example: "The public class GradedActivity extends Activity implements Comparable<GradedActivity> tells the compiler that GradedActivity is a public class that inherits from Activity and implements the Comparable interface."
Class instantiation
The process of creating a new object from a class definition using the new keyword and a constructor call.
Example: "The statement Student s = new Student("Jordan", 11); performs , calling the two-parameter constructor of Student to create a new object and storing a reference to it in the variable s."
Class method
A method that is invoked without reference to a particular object. Class methods affect the class as a whole, not a particular instance of the class. Also called a static method.
Example: "Math.sqrt(25.0) is called as a (static method) directly on the Math class without creating a Math object, returning the double value 5.0."
Class specification
A description of what a class does and how it should behave, including its public methods and their contracts, independent of implementation details.
Example: "Before coding, a team writes a for ShoppingCart that describes the public methods addItem(), removeItem(), getTotal(), and their expected behaviors, without dictating how the internal list of items will be stored."
Class variable
A variable declared with the static keyword that belongs to the class itself rather than to any instance; shared by all objects of the class.
Example: "Declaring private static int instanceCount = 0; inside a class and incrementing it in every constructor creates a that tracks how many objects of that class have been created across the entire program."
Code block
A sequence of Java statements enclosed in curly braces { }; defines the scope of variables declared within it.
Example: "A variable declared inside the of a for loop, such as int temp = arr[i];, is only accessible within that block and is destroyed when the loop iteration ends."
Code reuse
The practice of using existing classes and methods to solve new problems without rewriting code; supported by inheritance, APIs, and method decomposition.
Example: "By having SavingsAccount extend BankAccount, the programmer achieves because SavingsAccount inherits deposit() and getBalance() without rewriting them, and only adds the addInterest() behavior that is unique to savings accounts."
Code tracing
The process of manually following the execution of a program step by step to determine what values variables hold and what output is produced.
Example: "By through the loop for (int i = 1; i <= 4; i++) { sum += i; }, a student tracks that sum takes on the values 0, 1, 3, 6, and finally 10, confirming the loop computes the sum of 1 through 4."
Column
A vertical set of elements in a 2D array; the second index in a 2D array access (arr[row][col]) identifies the column.
Example: "Trajan's in Rome, completed in 113 CE, transforms the standard architectural into a public monument, its shaft wound with a continuous spiral relief of over 2,500 carved figures narrating the emperor's two Dacian campaigns with remarkable documentary specificity."
Column-major order
A traversal pattern for 2D arrays where all rows of one column are processed before moving to the next column; the outer loop iterates over columns, inner loop over rows.
Example: "To print a 2D array column by column, the programmer uses with the outer loop iterating col from 0 to arr[0].length - 1 and the inner loop iterating row from 0 to arr.length - 1, printing arr[row][col] each time."
Comment
Explanatory text in source code that is ignored by the compiler; Java supports single-line comments (//) and multi-line block comments (/* ... */).
Example: "A single-line written as // swap arr[i] and arr[j] above a three-line swap sequence helps a reader understand the intent of the code without reading every detail of the implementation."
Comparison operator
An operator that compares two values and returns a boolean; includes ==, !=,
Example: "The expression score >= 90 uses the >= to return true when score is 90 or above, which an if statement can then use to assign the letter grade 'A'."
Compiler
A program that translates source code written in a programming language (like Java) into bytecode or machine code that can be executed by a computer.
Example: "When a Java source file contains a method call with the wrong number of arguments, the reports a compile-time error before any bytecode is generated, preventing the flawed program from running."
Compound assignment operator
A shorthand operator that combines an arithmetic operation with assignment; examples include +=, -=, *=, /=, and %=.
Example: "Inside a loop that processes test scores, the statement total += scores[i]; uses the += as a concise alternative to writing total = total + scores[i];."
Compound expression
An expression that combines multiple operators and operands; operator precedence rules determine the order of evaluation.
Example: "The a + b * c - d / e is evaluated according to Java's operator precedence rules: multiplication and division are performed before addition and subtraction, so b * c and d / e are computed first."
Concatenation operator
The + operator when used with strings in Java to join them together; when a non-string is added to a string, it is automatically converted to a string.
Example: "The statement String message = "Score: " + score + "/" + total; uses the + to build a single string from a mix of string literals and integer variables, automatically converting each int to its string representation."
Concurrent modification
An error that occurs when an ArrayList is modified while being traversed with an enhanced for loop; use an index-based loop when adding or removing elements during traversal.
Example: "Attempting to call list.remove(element) inside an enhanced for loop over that list causes a ConcurrentModificationException; the correct approach is to use an index-based loop and decrement the index after each removal."
Conditional expression
A boolean expression used as the condition in an if statement or loop to determine which code path to follow.
Example: "In the loop while (left <= right), the left <= right controls how long the binary search continues, becoming false and stopping the loop when the search space is exhausted."
Conditional statement
A statement that executes different code depending on whether a boolean condition is true or false; includes if, if-else, and if-else-if chains.
Example: "An if-else-if assigns letter grades by checking if (score >= 90) for A, else if (score >= 80) for B, and so on, so only the first true branch executes."
Constructor
A special method with the same name as the class that is called when creating a new object using the new keyword; it initializes the object's instance variables.
Example: "The public Rectangle(double length, double width) { this.length = length; this.width = width; } initializes a new Rectangle object's instance variables whenever new Rectangle(5.0, 3.0) is called."
Constructor chaining
The process of one constructor calling another constructor in the same class using this(), or calling a superclass constructor using super().
Example: "A ColoredCircle class uses by calling super(radius) as the first statement in its constructor, delegating the initialization of the radius field to the parent Circle class constructor."
Constructor signature
The class name plus the ordered list of parameter types that uniquely identifies a constructor; used to distinguish overloaded constructors.
Example: "A class provides two constructors with different signatures—Point(int x, int y) and Point(double x, double y)—allowing callers to construct a Point using either integer or double coordinates."
Content equality
Comparing the actual data stored in two objects using the equals() method, rather than checking if they are the same object in memory.
Example: "Comparing two String objects with str1.equals(str2) tests and returns true when both strings contain the same sequence of characters, unlike == which only checks if they are the same object in memory."
Data abstraction
Hiding the implementation details of how data is stored and managed, exposing only the operations that can be performed on the data.
Example: "A Stack class achieves by exposing only push(), pop(), and peek() methods, hiding whether the underlying storage uses an array or a linked list so that callers are unaffected if the implementation changes."
Data structure
A way of organizing and storing data in a computer so that it can be accessed and modified efficiently; examples in AP CS A include arrays and ArrayLists.
Example: "An ArrayList<String> is the appropriate for a to-do list application because it allows dynamic insertion and deletion at any position, unlike a fixed-size array."
Data type
A classification that specifies what kind of value a variable can hold and what operations can be performed on it; examples include int, double, boolean, and String.
Example: "Choosing the double instead of int for a variable storing a student's GPA ensures that the fractional portion, such as the 0.75 in 3.75, is not truncated."
De Morgan's laws
Boolean algebra rules for negating compound expressions: !(A && B) is equivalent to !A || !B, and !(A || B) is equivalent to !A && !B.
Example: "When a programmer wants to skip processing an element unless it is both positive and even, they can rewrite the condition !(num > 0 && num % 2 == 0) using as num <= 0 || num % 2 != 0, which is often easier to reason about."
Declaration
A statement that introduces a variable to the compiler, specifying its name and data type (e.g., int score;).
Example: "The int count; tells the compiler to reserve a memory location for an integer variable named count, but it does not yet assign a value, so the variable must be initialized before use."
Decrement operator
The -- operator that subtracts 1 from a variable's value; for example, x-- is equivalent to x = x - 1.
Example: "In a countdown loop, i-- in the update expression of for (int i = 10; i >= 1; i--) decreases i by 1 after each iteration, causing the loop to print 10 through 1."
Default constructor
A constructor with no parameters that initializes instance variables to default values; Java provides one automatically if no constructors are defined.
Example: "If a programmer defines no constructors in the Point class, Java supplies a that creates a Point with x and y both initialized to 0, their default values for the int type."
Default value
The value automatically assigned to instance variables when an object is created without explicit initialization; numeric types default to 0, boolean to false, and reference types to null.
Example: "After creating a new int[5] array without explicit initialization, each element holds the 0, so iterating over the array immediately after creation will print five zeros."
Definition
A declaration that reserves storage (for data) or provides implementation (for methods).
Example: "The method public int square(int n) { return n * n; } both declares the method signature and provides its implementation, while a mere declaration would only state the signature without a body."
Divide-and-conquer
An algorithm design strategy that breaks a problem into smaller subproblems, solves each subproblem recursively, and combines the results; used by merge sort and binary search.
Example: "Merge sort applies the strategy by recursively splitting the array in half until each subarray has one element, then merging the sorted halves back together, resulting in an O(n log n) overall sort."
Dot operator
The . symbol used to access members (methods or fields) of an object or class.
Example: "The expression student.getName() uses the to invoke the getName() method on the student object, accessing its behavior through the object reference."
Double
A primitive data type in Java that stores 64-bit double-precision floating-point numbers, used for decimal values.
Example: "Storing a temperature reading in <u> </u> temperature = 98.6; uses the <u> </u> type to preserve the decimal precision that an int would lose by truncating to 98."
Dynamic binding
The process by which Java determines at runtime which version of an overridden method to call, based on the actual type of the object rather than the reference type.
Example: "When an Animal reference variable holds a Cat object and makeSound() is called, Java uses to invoke Cat's overridden version of makeSound() at runtime rather than Animal's version."
Early return
A return statement that exits a method before reaching the end of the method body when a certain condition is met; useful for simplifying logic.
Example: "A method searching for a target in an array uses an : if (arr[i] == target) return i; inside the loop, immediately exiting with the found index rather than continuing to scan the rest of the array."
Element-based traversal
Iterating through an array using an enhanced for loop that accesses each element directly rather than by index; useful for reading but cannot modify element references.
Example: "Using for (int score : scores) to sum all grades in an array is an that reads each value directly without an index, but it cannot be used to reassign array elements since score is a copy of each value."
Encapsulation
An object-oriented design principle where the internal state of an object is hidden from outside access by declaring variables private and providing public accessor and mutator methods.
Example: "By declaring private double balance; and providing only public void deposit(double amount) and public double getBalance(), the BankAccount class uses to prevent external code from setting the balance to an invalid negative value."
Enhanced for loop
A simplified for loop syntax used to iterate over all elements of an array or ArrayList without needing an index variable; syntax: for (Type element : collection).
Example: "The for (String name : nameList) iterates over every element in the ArrayList<String> named nameList, assigning each string to name in turn without requiring the programmer to manage an index variable."
Equals() method
A method inherited from the Object class used to test whether two objects are logically equal; should be overridden to compare object contents rather than references.
Example: "Two Student objects with the same id field should be considered equal, so the Student class overrides equals() to return true when this.id == other.id rather than when they are the same object in memory."
Escape sequence
A combination of characters starting with a backslash that represents a special character in a string; examples include \n for newline, \t for tab, and \" for double quote.
Example: "The statement System.out.println("Name:\tAlice\nGrade:\t95"); uses the \t for a tab character and \n for a newline to format the output into two neatly aligned lines."