zuai-logo
zuai-logo
  1. AP Computer Science A
FlashcardFlashcard
Study GuideStudy GuideQuestion BankQuestion BankGlossaryGlossary

What is an int?

A primitive data type representing whole numbers.

Flip to see [answer/question]
Flip to see [answer/question]
Revise later
SpaceTo flip
If confident

All Flashcards

What is an int?

A primitive data type representing whole numbers.

What is a double?

A primitive data type representing decimal numbers.

What is a boolean?

A primitive data type representing true or false values.

What is modulo?

An arithmetic operator (%) that returns the remainder of a division.

What is a compound assignment operator?

An operator that combines an arithmetic operation and assignment (e.g., +=, -=).

What is post-increment?

An operator (x++) that returns the original value of x, then increments it.

What is pre-increment?

An operator (++x) that increments x, then returns the new value.

What is short-circuit evaluation?

The process where the second condition in AND/OR operations isn't evaluated if the result is already known.

What is a String?

A sequence of characters, immutable in Java.

What is a class?

A blueprint for creating objects, containing data (fields) and behavior (methods).

What is an object?

An instance of a class, created using the new keyword.

What is a constructor?

A special method used to initialize objects, having the same name as the class.

What is an array?

An ordered collection of elements of the same type with a fixed size.

What is an ArrayList?

A dynamic, resizable array in Java.

What is inheritance?

A mechanism where a class (subclass) inherits properties and methods from another class (superclass).

What is polymorphism?

The ability of an object to take on many forms, achieved through inheritance and method overriding.

What is recursion?

A method that calls itself, requiring a base case to stop the recursion.

What are the steps to create an object?

  1. Declare a variable of the class type. 2. Use the new keyword followed by the class constructor. 3. Assign the result to the variable.

What are the steps to traverse an array?

  1. Use a for loop or enhanced for loop. 2. Initialize a counter (if using a for loop). 3. Access each element using its index.

What are the steps to traverse a 2D array?

  1. Use nested for loops. 2. The outer loop iterates through rows. 3. The inner loop iterates through columns.

What are the steps in calling a superclass constructor?

  1. Use the super() keyword in the subclass constructor. 2. Provide the necessary parameters that match the superclass constructor's signature. 3. This call must be the first statement in the subclass constructor.

What are the steps to implement recursion?

  1. Identify the base case(s). 2. Define the recursive step, calling the method itself with a modified input. 3. Ensure the recursive step moves towards the base case.

What are the differences between arrays and ArrayLists?

Arrays: Fixed size, primitive and object types, length property. ArrayLists: Dynamic size, object types only, methods like add(), remove(), size().

What are the differences between == and .equals() for Strings?

==: Compares object references. .equals(): Compares the content of the strings.

What are the differences between for and while loops?

for: Used when the number of iterations is known. while: Used when the number of iterations is unknown, and depends on a condition.

What are the differences between method overloading and method overriding?

Overloading: Multiple methods with the same name but different parameters in the same class. Overriding: A subclass providing a different implementation for a method already defined in its superclass.

What are the differences between x++ and ++x?

x++: Post-increment, returns the original value then increments. ++x: Pre-increment, increments then returns the new value.