Core Java programming concepts including classes, arrays, and control flow, tested on AP Computer Science A.
40 cards · basic cards · AI-written, checked twice. Edit anything.
- What is a class in Java?
- A blueprint or template for creating objects with shared properties and methods
- Define an object.
- An instance of a class that has state (attributes) and behavior (methods)
- What is encapsulation?
- Bundling data and methods together in a class while hiding internal implementation details
- What is a constructor?
- A special method that initializes an object when it is created with the new keyword
- What is inheritance?
- A mechanism where a subclass inherits properties and methods from a parent (superclass)
- What is polymorphism?
- The ability of methods to behave differently depending on the object that calls them or the parameters passed
- What is an array?
- An ordered collection of elements of the same data type stored in contiguous memory
- What is a method?
- A block of code that performs a specific task and is defined within a class
- Name the three access modifiers in Java.
- public (accessible everywhere), private (accessible only in the class), protected (accessible in subclasses and same package)
- What is an instance variable?
- A variable declared within a class but outside all methods; each object has its own copy
- What is a static variable?
- A class variable that is shared by all instances of a class, declared with the static keyword
- What is a local variable?
- A variable declared and used only within a method or code block
- What does the new keyword do?
- Creates a new instance of a class by allocating memory and calling the constructor
- What is a reference variable?
- A variable that stores the memory address (reference) to an object, not the object itself
- What does null represent?
- A special value indicating that a reference variable does not point to any object