AP Computer Science a Flashcards: Objects Instances Of Classes

Study Objects Instances Of Classes in AP Computer Science a with focused flashcards that help you recognize the idea, recall the key rule, and apply it in practice-style prompts.

AP Computer Science a

Objects Instances Of Classes

0 mastered0 still learning

0% Complete

QUESTION
1/ 67

What is the main benefit of using interfaces?

Tap card or press Space to flip

ANSWER

Support multiple inheritance of type. Classes can implement multiple interfaces for flexible design.

How well did you know it?

Card 1 / 67

What this deck covers

This deck focuses on Objects Instances Of Classes, giving you a quick way to review the definitions, rules, and examples that matter most for AP Computer Science a.

How to use these flashcards

Work through these flashcards in short sessions. Try to answer each prompt before flipping the card, then revisit any cards you miss until the explanation feels automatic.

All flashcards

Flashcard 1: What is the main benefit of using interfaces?

Answer: Support multiple inheritance of type. Classes can implement multiple interfaces for flexible design.

Flashcard 2: Which operator is used to check if two references point to the same object?

Answer: ==. Tests reference equality, not object content comparison.

Flashcard 3: What is the significance of the 'protected' access modifier?

Answer: Accessible within package and subclasses. Allows package and subclass access while restricting others.

Flashcard 4: What does the 'this' keyword represent in a class?

Answer: Current object instance. Allows access to current object's fields and methods within class.

Flashcard 5: Identify the keyword used to inherit from another class.

Answer: extends. Establishes parent-child relationship between classes for code reuse.

Flashcard 6: Identify the method used to initialize an object in Java.

Answer: Constructor. Constructors set initial values for object instance variables.

Flashcard 7: What is the significance of the 'protected' access modifier?

Answer: Accessible within package and subclasses. Allows package and subclass access while restricting others.

Flashcard 8: Identify the collection that does not allow duplicate elements.

Answer: Set. Mathematical set behavior ensures unique element storage.

Flashcard 9: What is method overriding?

Answer: Subclass provides specific implementation of a method already defined in its superclass. Allows customized behavior while maintaining same method signature.

Flashcard 10: What does the 'static' keyword indicate about a method or variable?

Answer: Belongs to the class, not any instance. Shared across all instances rather than per-object storage.

Flashcard 11: What makes a method abstract?

Answer: Declared without an implementation. Must be implemented by concrete subclasses to provide functionality.

Flashcard 12: Which keyword is used to refer to the current instance of a class?

Answer: this. References the specific object calling the method or constructor.

Flashcard 13: What is the purpose of a constructor?

Answer: Initialize an object. Sets up initial state and prepares object for use.

Flashcard 14: What is the purpose of the 'super' keyword?

Answer: Access parent class methods and constructors. Enables access to inherited functionality from parent class.

Flashcard 15: What is the result of calling a constructor with no arguments?

Answer: Default constructor is invoked. Creates object with default field values when no parameters given.

Flashcard 16: What is the main benefit of using interfaces?

Answer: Support multiple inheritance of type. Classes can implement multiple interfaces for flexible design.

Flashcard 17: Which keyword is used to refer to the current instance of a class?

Answer: this. References the specific object calling the method or constructor.

Flashcard 18: Which access modifier makes a class member accessible from any other class?

Answer: public. Provides unrestricted access across all classes and packages.

Flashcard 19: What is the result of calling a constructor with no arguments?

Answer: Default constructor is invoked. Creates object with default field values when no parameters given.

Flashcard 20: What is encapsulation in object-oriented programming?

Answer: Hiding internal state and requiring all interaction through methods. Protects data integrity by controlling access through methods.

Flashcard 21: What is the return type of a constructor?

Answer: No return type. Constructors initialize objects but don't return values.

Flashcard 22: Identify the method that returns a string representation of an object.

Answer: toString(). Provides readable text representation for debugging and display.

Flashcard 23: What is the default value of an object reference in Java?

Answer: null. Uninitialized object references automatically default to null value.

Flashcard 24: What does 'inheritance' mean in object-oriented programming?

Answer: A class inherits fields and methods from another class. Promotes code reuse by sharing parent class features.

Flashcard 25: Which keyword is used to declare a constant in Java?

Answer: final. Makes variables immutable after initial assignment.

Flashcard 26: Which function is used to compare two objects for equality?

Answer: equals(). Compares object content rather than reference addresses.

Flashcard 27: What is the default value of an object reference in Java?

Answer: null. Uninitialized object references automatically default to null value.

Flashcard 28: Which collection allows duplicate elements?

Answer: List. Ordered collections that maintain insertion order and duplicates.

Flashcard 29: Identify the collection that does not allow duplicate elements.

Answer: Set. Mathematical set behavior ensures unique element storage.

Flashcard 30: What is the process of creating an object called?

Answer: Instantiation. The act of creating a specific object from a class blueprint.

Flashcard 31: What does 'instance variable' mean?

Answer: A variable defined in a class for which each instantiated object has its own value. Each object maintains its own copy of these variables.

Flashcard 32: What is method overloading?

Answer: Multiple methods with the same name but different parameters. Enables method reuse with different parameter combinations.

Flashcard 33: Which keyword is used to define an interface?

Answer: interface. Defines contracts that implementing classes must fulfill.

Flashcard 34: What is polymorphism in object-oriented programming?

Answer: Ability of different classes to be treated as instances of the same class through inheritance. Enables single interface to represent different underlying types.

Flashcard 35: What makes a method abstract?

Answer: Declared without an implementation. Must be implemented by concrete subclasses to provide functionality.

Flashcard 36: What is an abstract class?

Answer: A class that cannot be instantiated and may contain abstract methods. Serves as template requiring subclasses to implement methods.

Flashcard 37: Which access modifier makes a class member accessible from any other class?

Answer: public. Provides unrestricted access across all classes and packages.

Flashcard 38: Which method is called automatically when an object is created?

Answer: Constructor. Constructors execute automatically during object creation process.

Flashcard 39: What does 'instance variable' mean?

Answer: A variable defined in a class for which each instantiated object has its own value. Each object maintains its own copy of these variables.

Flashcard 40: Which keyword is used to create an object in Java?

Answer: new. The 'new' keyword allocates memory and calls the constructor.

Flashcard 41: What is the difference between an ArrayList and an array?

Answer: ArrayList is resizable, array has fixed size. ArrayList grows dynamically while arrays have compile-time size.

Flashcard 42: Which function is used to compare two objects for equality?

Answer: equals(). Compares object content rather than reference addresses.

Flashcard 43: Which operator is used to check if two references point to the same object?

Answer: ==. Tests reference equality, not object content comparison.

Flashcard 44: What is the difference between an ArrayList and an array?

Answer: ArrayList is resizable, array has fixed size. ArrayList grows dynamically while arrays have compile-time size.

Flashcard 45: What type of method can only be called from an instance of the class?

Answer: Instance method. Non-static methods require object instance to be invoked.

Flashcard 46: What type of method can only be called from an instance of the class?

Answer: Instance method. Non-static methods require object instance to be invoked.

Flashcard 47: What is polymorphism in object-oriented programming?

Answer: Ability of different classes to be treated as instances of the same class through inheritance. Enables single interface to represent different underlying types.

Flashcard 48: Identify the keyword used to inherit from another class.

Answer: extends. Establishes parent-child relationship between classes for code reuse.

Flashcard 49: Which collection allows duplicate elements?

Answer: List. Ordered collections that maintain insertion order and duplicates.

Flashcard 50: What is a class method in Java?

Answer: A method that belongs to the class, rather than any object instance. Static methods can be called without creating object instances.

Flashcard 51: Identify the keyword used to implement an interface.

Answer: implements. Establishes contract between interface and implementing class.

Flashcard 52: How do you access a class variable?

Answer: ClassName.variableName. Static variables belong to class, accessed via class name.

Flashcard 53: What does the 'this' keyword represent in a class?

Answer: Current object instance. Allows access to current object's fields and methods within class.

Flashcard 54: What is encapsulation in object-oriented programming?

Answer: Hiding internal state and requiring all interaction through methods. Protects data integrity by controlling access through methods.

Flashcard 55: Identify the method used to initialize an object in Java.

Answer: Constructor. Constructors set initial values for object instance variables.

Flashcard 56: Identify the keyword used to implement an interface.

Answer: implements. Establishes contract between interface and implementing class.

Flashcard 57: What does the 'static' keyword indicate about a method or variable?

Answer: Belongs to the class, not any instance. Shared across all instances rather than per-object storage.

Flashcard 58: How do you access a class variable?

Answer: ClassName.variableName. Static variables belong to class, accessed via class name.

Flashcard 59: Identify the keyword that prevents a class from being subclassed.

Answer: final. Prevents inheritance by making class non-extendable.

Flashcard 60: What is an object in Java?

Answer: An instance of a class. Objects are concrete realizations of classes with specific data values.

Flashcard 61: Which keyword is used to define an interface?

Answer: interface. Defines contracts that implementing classes must fulfill.

Flashcard 62: What is the purpose of the 'super' keyword?

Answer: Access parent class methods and constructors. Enables access to inherited functionality from parent class.

Flashcard 63: What is an object in Java?

Answer: An instance of a class. Objects are concrete realizations of classes with specific data values.

Flashcard 64: What is the process of creating an object called?

Answer: Instantiation. The act of creating a specific object from a class blueprint.

Flashcard 65: Which method is called automatically when an object is created?

Answer: Constructor. Constructors execute automatically during object creation process.

Flashcard 66: Identify the keyword that prevents a class from being subclassed.

Answer: final. Prevents inheritance by making class non-extendable.

Flashcard 67: What does 'inheritance' mean in object-oriented programming?

Answer: A class inherits fields and methods from another class. Promotes code reuse by sharing parent class features.