Java Final Exam Review

0.0(0)
studied byStudied by 0 people
0.0(0)
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/110

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 3:52 AM on 2/3/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

111 Terms

1
New cards

platform independence

"Java's ability to run on any operating system without modification because programs run on the JVM rather than directly on hardware. Example: The same .class file runs on Windows, Mac, and Linux."

2
New cards

Java Virtual Machine (JVM)

"The software that executes Java bytecode. It provides platform independence by translating bytecode into machine-specific instructions."

3
New cards

Java Development Kit (JDK)

"The complete package for developing Java programs, including the compiler (javac), debugger, and JRE."

4
New cards

Java Runtime Environment (JRE)

"Contains only what's needed to run Java programs (JVM + libraries), but not to compile them."

5
New cards

bytecode

"The intermediate compiled code (.class files) that the JVM executes. It's not human-readable and not machine code—it sits in between."

6
New cards

javac

"_______ HelloWorld.java compiles a Java source file into bytecode"

7
New cards

java

"_______ HelloWorld runs a compiled Java program from the command line"

8
New cards

main

"public static void _______(String[] args) - the method signature for a program's entry point"

9
New cards

class

"A blueprint that defines the data (fields) and behavior (methods) for objects. Example: A Car class defines that all cars have a color and can accelerate()."

10
New cards

object

"An instance of a class with its own copy of instance variables. Example: myCar and yourCar are two separate objects of the Car class."

11
New cards

encapsulation

"OOP principle of bundling data with the methods that operate on it while restricting direct access. Example: A BankAccount class keeps balance private and only allows changes through deposit() and withdraw()."

12
New cards

inheritance

"OOP principle where a class acquires fields and methods from a parent class using extends. Example: class Dog extends Animal means Dog inherits all of Animal's non-private members."

13
New cards

polymorphism

"OOP principle allowing objects of different classes to be treated through a common interface. Example: Animal[] pets can hold Dog and Cat objects, and pets[i].speak() runs each animal's specific implementation."

14
New cards

camelCase

"Naming convention for variables and methods: first word lowercase, subsequent words capitalized. Example: firstName, calculateTotalPrice"

15
New cards

//

"_______ This is a single-line comment"

16
New cards

/*

"_______ This is a multi-line comment that can span several lines */"

17
New cards

import

"_______ java.util.Scanner; makes the Scanner class available in your code"

18
New cards

java.lang package

"The default package automatically available in every Java program without an import statement. Contains String, Math, System, Integer, and Object."

19
New cards

int

"_______ count = 42; declares a 32-bit integer variable"

20
New cards

double

"_______ price = 19.99; declares a 64-bit floating-point variable"

21
New cards

boolean

"_______ isGameOver = false; declares a variable that holds only true or false"

22
New cards

char

"_______ letter = 'A'; declares a variable that holds a single Unicode character (note the single quotes)"

23
New cards

float

"_______ temperature = 98.6f; declares a 32-bit floating-point variable (note the f suffix)"

24
New cards

primitive vs reference types

"Primitives (int, double, boolean, etc.) store actual values directly. Reference variables (String, arrays, objects) store memory addresses pointing to objects."

25
New cards

variable

"A named storage location in memory that holds a value of a declared type"

26
New cards

final

"_______ double TAX_RATE = 0.07; declares a constant that cannot be changed after initialization"

27
New cards

(int)

"double gpa = 3.7; int rounded = _______ gpa; casts the double to an integer (truncates to 3)"

28
New cards

String

"_______ greeting = ""Hello""; declares a reference variable for a sequence of characters"

29
New cards

wrapper class

"Object versions of primitive types (Integer, Double, Boolean, Character) that allow primitives to be used where objects are required, such as in ArrayLists."

30
New cards

autoboxing

"Automatic conversion between primitives and their wrapper classes. Example: Integer num = 5; automatically wraps the int 5 in an Integer object."

31
New cards

Integer.parseInt

"int age = _______(""25""); converts a String to a primitive int"

32
New cards

%

"int remainder = 17 _______ 5; the modulus operator returns 2 (the remainder of division)"

33
New cards

++

"count_______; increments count by 1 (post-increment)"

34
New cards

--

"count_______; decrements count by 1 (post-decrement)"

35
New cards

+=

"total _______ 10; adds 10 to total and stores the result back in total"

36
New cards

operator precedence

"The order Java evaluates operators: parentheses first, then , /, % before +, -. Example: 2 + 3 4 equals 14, not 20."

37
New cards

==

"Equality operator that compares primitive values directly, but compares memory addresses (not content) for objects. Use .equals() to compare object content."

38
New cards

equals

"if (str1._______(str2)) compares the actual content of two Strings or objects"

39
New cards

&&

"if (age >= 18 _______ hasID) - logical AND returns true only when BOTH conditions are true"

40
New cards

||

"if (isStudent _______ isSenior) - logical OR returns true when AT LEAST ONE condition is true"

41
New cards

?:

"int max = (a > b) _______ a : b; the ternary operator returns a if condition is true, b otherwise"

42
New cards

length()

"int size = name._______; returns the number of characters in a String (note: method with parentheses)"

43
New cards

charAt

"char first = name._______(0); returns the character at the specified index"

44
New cards

substring

"String part = name._______(0, 4); extracts characters from index 0 up to but not including index 4"

45
New cards

indexOf

"int pos = name._______(""a""); returns the index of first occurrence, or -1 if not found"

46
New cards

compareTo

"int result = str1._______(str2); returns negative if str1 < str2, zero if equal, positive if str1 > str2 (alphabetically)"

47
New cards

immutability

"A property of Strings meaning they cannot be modified after creation. Methods like toUpperCase() return a NEW String rather than changing the original."

48
New cards

\n

"System.out.print(""Hello_______World""); prints Hello and World on separate lines (newline escape sequence)"

49
New cards

printf

"System.out._______(""Score: %d"", points); formats and prints output using format specifiers"

50
New cards

%d

"System.out.printf(""Count: _______"", num); format specifier for integers in printf"

51
New cards

Math.random()

"double rand = _______; returns a random double from 0.0 (inclusive) to 1.0 (exclusive)"

52
New cards

Math.pow

"double result = _______(2, 8); returns 2 raised to the 8th power (256.0)"

53
New cards

Math.sqrt

"double root = _______(144); returns the square root (12.0)"

54
New cards

nextInt

"Random rand = new Random(); int die = rand._______(6) + 1; generates random int from 1 to 6"

55
New cards

if

"_______ (score >= 90) { grade = 'A'; } executes the block only when condition is true"

56
New cards

else

"if (x > 0) { } _______ { } executes the second block when the if condition is false"

57
New cards

switch

"_______ (dayNum) { case 1: ... } selects code to execute based on a value"

58
New cards

case

"switch (grade) { _______ 'A': System.out.println(""Excellent""); break; } - a label matching a possible value"

59
New cards

default

"switch (x) { case 1: ... _______: ... } executes when no case matches"

60
New cards

for

"_______ (int i = 0; i < 10; i++) { } repeats code with initialization, condition, and update in one line"

61
New cards

:

"for (String name _______ names) { } the enhanced for loop iterates through each element of a collection"

62
New cards

while

"_______ (guess != answer) { } repeats code as long as the condition remains true"

63
New cards

do-while loop

"A loop that executes the body at least once before checking the condition. Syntax: do { code } while (condition);"

64
New cards

break

"The _______ statement immediately exits the current loop or switch block"

65
New cards

continue

"The _______ statement skips the rest of the current iteration and jumps to the next iteration"

66
New cards

syntax error

"A code structure mistake caught by the compiler. Example: missing semicolon, mismatched braces, misspelled keyword."

67
New cards

logic error

"Code that compiles and runs but produces incorrect results. Example: using < instead of <= causing an off-by-one error."

68
New cards

try

"_______ { riskyCode(); } wraps code that might throw an exception"

69
New cards

catch

"try { } _______ (Exception e) { } handles a specific type of exception when it occurs"

70
New cards

NullPointerException

"Thrown when you try to use a reference variable that points to null. Example: calling str.length() when str is null."

71
New cards

ArrayIndexOutOfBoundsException

"Thrown when accessing an invalid array index. Example: accessing arr[5] when the array only has 5 elements (indices 0-4)."

72
New cards

new int[5]

"int[] scores = _______; creates an array that can hold 5 integers (indices 0-4)"

73
New cards

"{10

20, 30}","int[] nums = _______; declares and initializes an array with three values using an initializer list"

74
New cards

.length

"int size = myArray_______; returns the number of elements in an array (note: property without parentheses)"

75
New cards

new int[3][4]

"int[][] grid = _______; creates a 2D array with 3 rows and 4 columns"

76
New cards

fixed vs dynamic size

"Arrays have a fixed size set at creation and can hold primitives. ArrayLists resize dynamically but can only hold objects (Integer, not int)."

77
New cards

new ArrayList()

"ArrayList names = _______; creates an empty ArrayList that holds Strings"

78
New cards

add

"names._______(""Alice""); appends an element to the end of an ArrayList"

79
New cards

get

"String first = names._______(0); retrieves the element at the specified index"

80
New cards

size()

"int count = names._______; returns the number of elements in an ArrayList (note: method with parentheses)"

81
New cards

constructor

"A special method with the same name as the class that initializes new objects. Called automatically when you use the new keyword."

82
New cards

this

"_______.name = name; refers to the current object's instance variable, distinguishing it from a parameter with the same name"

83
New cards

private

"_______ String password; restricts access so only code within the same class can access this field"

84
New cards

public

"_______ void displayInfo() { } allows this method to be called from any other class"

85
New cards

method overloading

"Defining multiple methods with the same name but different parameter lists. Example: print(int x) and print(String s) can coexist in the same class."

86
New cards

accessor method

"A getter that returns a private field's value without allowing direct modification. Example: public String getName() { return name; }"

87
New cards

mutator method

"A setter that allows controlled modification of a private field. Example: public void setName(String n) { name = n; }"

88
New cards

static

"A _______ method or variable belongs to the class itself rather than to instances. Called using ClassName.methodName()."

89
New cards

return

"public int getAge() { _______ age; } exits the method and sends back a value to the caller"

90
New cards

lambda expression

"A concise way to represent an anonymous function. Syntax: (parameters) -> expression. Example: (x, y) -> x + y"

91
New cards

->

"(x, y) _______ x + y; the arrow operator separates parameters from the body in a lambda expression"

92
New cards

functional interface

"An interface with exactly one abstract method, making it eligible for lambda expressions. Example: Runnable, Comparator, ActionListener."

93
New cards

stream

"A sequence of elements that supports aggregate operations like filter, map, and reduce. Created from collections using .stream()."

94
New cards

filter

"numbers.stream()._______.(n -> n > 0) returns a stream containing only elements that match the predicate"

95
New cards

map

"names.stream()._______.(s -> s.toUpperCase()) transforms each element and returns a stream of the results"

96
New cards

collect

"stream._______.(Collectors.toList()) converts a stream back into a collection like a List"

97
New cards

JFrame

"The main window container in Swing. Example: _______ frame = new JFrame(""My App""); creates a top-level window."

98
New cards

JPanel

"A container component used to group and organize other components within a JFrame."

99
New cards

JButton

"_______ btn = new JButton(""Click Me""); creates a clickable button component"

100
New cards

JLabel

"_______ label = new JLabel(""Hello""); creates a component that displays text or an image"