This term describes a blueprint for creating objects; it defines attributes and behaviors.
Class
The shorthand operator that adds a value to a variable and assigns the result in one step (write the operator symbol)
+=
What Java syntax indicates a variable is an array of integers (two possible common forms)?
int[] or int arrayName[]
What keyword would you give a variable so it's only accessible inside its class (one-word answer)?
private
Name the term for a specific instance created from a class.
Object (instance)
Write an equivalent expression: speed += 10; (give the full expanded assignment)
speed = speed + 10
If you create an array with an initializer list like {2, 4, 6}, can you later add a new element to change its size? Explain briefly.
No — array size is fixed; you cannot change capacity after creation.
What are getters and setters used for? Provide a short definition for each.
Getter returns a variable's value; setter assigns/validates a new value.
The keyword used inside a class to refer to the current object (for example, used to reference instance variables when parameter names collide).
this.
Identify whether the following is postfix or prefix: variable++ — and explain what postfix means in terms of when the increment happens relative to using the value
Postfix; increment happens after the expression uses the current value.
What is the default value for elements in a new int[] array in Java (before you set any elements)?
0
This special method initializes an object when it's created and often has the same name as the class.
Constructor
Define implicit casting and give a simple example converting an int to a double using a variable named a
Implicit casting automatically converts smaller to larger types; example: int a = 22; double b = a; 401: int d = (int) c; d becomes 22
Given an array named scores, write a single-line Java for-loop header (only the header) that traverses all indices from 0 to length-1.
for (int i = 0; i < scores.length; i++){}
The notes call encapsulation a principle — restate that principle in your own words, referencing protection or control of data.
Encapsulation protects data by restricting access and providing controlled interfaces (getters/setters).
Explain in one sentence why Java is considered an object-oriented language (mention classes or objects).
Because Java models programs using classes that define objects with attributes and behaviors (answers may vary; teacher judgment).
Describe two common uses of traversing arrays (give any two examples from the notes)
Print all values, find average, totals, search, modify values (any two).
Suppose you have a private instance variable age. Write a getter method signature (Java) that returns an int called getAge (just the signature line, not the body).
public int getAge();