AP Computer Science a Flashcards: Anatomy Of A Class

Study Anatomy Of A Class 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

Anatomy Of A Class

0 mastered0 still learning

0% Complete

QUESTION
1/ 67

What is the signature of a method?

Tap card or press Space to flip

ANSWER

The method's name and parameter list. Identifies method for compilation and overriding.

How well did you know it?

Card 1 / 67

What this deck covers

This deck focuses on Anatomy Of A Class, 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 signature of a method?

Answer: The method's name and parameter list. Identifies method for compilation and overriding.

Flashcard 2: What is the purpose of a constructor?

Answer: To initialize a new object of a class. Sets initial values for object fields.

Flashcard 3: What is method overriding?

Answer: Redefining a method in a subclass that exists in the superclass. Child class replaces parent's method implementation.

Flashcard 4: What is a method in a Java class?

Answer: A block of code that performs a specific task. Defines behavior that objects can perform.

Flashcard 5: What is encapsulation in Java?

Answer: Hiding data fields using access modifiers. Core OOP principle for data protection.

Flashcard 6: Identify the superclass of all classes in Java.

Answer: Object. Root class that all Java classes inherit from.

Flashcard 7: What is the main purpose of a Java interface?

Answer: To specify methods that a class must implement. Enforces method contracts without implementation.

Flashcard 8: What is an abstract class?

Answer: A class that cannot be instantiated and may contain abstract methods. Serves as template requiring subclass implementation.

Flashcard 9: What is the signature of a method?

Answer: The method's name and parameter list. Identifies method for compilation and overriding.

Flashcard 10: What is the static keyword used for?

Answer: To define class-level fields and methods. Belongs to class rather than instances.

Flashcard 11: Which access modifier restricts visibility to the containing class?

Answer: private. Most restrictive access level for data hiding.

Flashcard 12: What is a class in Java?

Answer: A blueprint for creating objects, defining fields and methods. Encapsulates data and behavior for object creation.

Flashcard 13: What is the purpose of a constructor?

Answer: To initialize a new object of a class. Sets initial values for object fields.

Flashcard 14: What is method overloading?

Answer: Defining multiple methods with the same name but different parameters. Same name, different parameter signatures.

Flashcard 15: What is an abstract class?

Answer: A class that cannot be instantiated and may contain abstract methods. Serves as template requiring subclass implementation.

Flashcard 16: Which access modifier allows visibility to all classes?

Answer: public. Provides unrestricted access from anywhere.

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

Answer: toString(). Provides readable format for object display.

Flashcard 18: Identify the method that initializes an object.

Answer: Constructor. Special method that sets up new object instances.

Flashcard 19: Which keyword prevents a class from being subclassed?

Answer: final. Prevents inheritance to maintain class integrity.

Flashcard 20: Identify the superclass of all classes in Java.

Answer: Object. Root class that all Java classes inherit from.

Flashcard 21: Identify the keyword used to import a package.

Answer: import. Makes external classes available in current file.

Flashcard 22: Which keyword is used to implement an interface?

Answer: implements. Establishes contract between class and interface.

Flashcard 23: What is the purpose of the 'this' keyword?

Answer: Refers to the current instance of a class. Distinguishes between instance and parameter variables.

Flashcard 24: What is a field in a Java class?

Answer: A variable declared within a class. Stores data as part of an object's state.

Flashcard 25: What is the difference between == and equals()?

Answer: == checks reference; equals() checks value equality. Reference vs content comparison distinction.

Flashcard 26: Which keyword is used to declare an abstract class?

Answer: abstract. Prevents direct instantiation of the class.

Flashcard 27: What is the difference between == and equals()?

Answer: == checks reference; equals() checks value equality. Reference vs content comparison distinction.

Flashcard 28: What keyword is used to inherit from a class?

Answer: extends. Creates parent-child relationship between classes.

Flashcard 29: What is the purpose of the 'this' keyword?

Answer: Refers to the current instance of a class. Distinguishes between instance and parameter variables.

Flashcard 30: What is polymorphism in Java?

Answer: The ability to process objects differently based on their data type. Enables one interface with multiple implementations.

Flashcard 31: Identify the method that is automatically called when an object is created.

Answer: Constructor. Invoked immediately upon object instantiation.

Flashcard 32: What is encapsulation in Java?

Answer: Hiding data fields using access modifiers. Core OOP principle for data protection.

Flashcard 33: Identify the keyword to declare a constant in Java.

Answer: final. Makes fields or variables unchangeable after initialization.

Flashcard 34: What is inheritance in Java?

Answer: A mechanism where one class acquires the properties of another. Child class gains parent's properties and methods.

Flashcard 35: Identify the keyword used to import a package.

Answer: import. Makes external classes available in current file.

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

Answer: new. Allocates memory and invokes the constructor.

Flashcard 37: Which access modifier restricts visibility to the containing class?

Answer: private. Most restrictive access level for data hiding.

Flashcard 38: What is a field in a Java class?

Answer: A variable declared within a class. Stores data as part of an object's state.

Flashcard 39: Which access modifier allows visibility within the same package only?

Answer: default (no modifier). Package-private access when no modifier specified.

Flashcard 40: What is an object in the context of Java?

Answer: An instance of a class containing fields and methods. A concrete realization of a class template.

Flashcard 41: What is method overloading?

Answer: Defining multiple methods with the same name but different parameters. Same name, different parameter signatures.

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

Answer: equals(). Compares object content rather than references.

Flashcard 43: Which access modifier allows visibility within the same package only?

Answer: default (no modifier). Package-private access when no modifier specified.

Flashcard 44: What is a package in Java?

Answer: A namespace that organizes classes and interfaces. Groups related classes for organization.

Flashcard 45: What is the static keyword used for?

Answer: To define class-level fields and methods. Belongs to class rather than instances.

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

Answer: new. Allocates memory and invokes the constructor.

Flashcard 47: Identify the default value of an int field in Java.

Answer:

  1. Numeric primitives initialize to zero by default.

Flashcard 48: What is a package in Java?

Answer: A namespace that organizes classes and interfaces. Groups related classes for organization.

Flashcard 49: Can a Java class implement multiple interfaces?

Answer: Yes, a class can implement multiple interfaces. Multiple inheritance through interfaces is allowed.

Flashcard 50: Which keyword is used to invoke a superclass's constructor?

Answer: super. Calls parent constructor or method explicitly.

Flashcard 51: What does the keyword 'super' refer to in Java?

Answer: The superclass of the current object. Accesses parent class members and methods.

Flashcard 52: Identify the keyword used to declare a class in Java.

Answer: class. The reserved word that starts all class definitions.

Flashcard 53: What is method overriding?

Answer: Redefining a method in a subclass that exists in the superclass. Child class replaces parent's method implementation.

Flashcard 54: What is the default value of a boolean field in Java?

Answer: false. Primitive types initialize to false automatically.

Flashcard 55: What is a class in Java?

Answer: A blueprint for creating objects, defining fields and methods. Encapsulates data and behavior for object creation.

Flashcard 56: Identify the method that initializes an object.

Answer: Constructor. Special method that sets up new object instances.

Flashcard 57: What is a method in a Java class?

Answer: A block of code that performs a specific task. Defines behavior that objects can perform.

Flashcard 58: Identify the keyword used to declare a class in Java.

Answer: class. The reserved word that starts all class definitions.

Flashcard 59: Which keyword is used to invoke a superclass's constructor?

Answer: super. Calls parent constructor or method explicitly.

Flashcard 60: Can a Java class implement multiple interfaces?

Answer: Yes, a class can implement multiple interfaces. Multiple inheritance through interfaces is allowed.

Flashcard 61: What is the default value of a boolean field in Java?

Answer: false. Primitive types initialize to false automatically.

Flashcard 62: What is polymorphism in Java?

Answer: The ability to process objects differently based on their data type. Enables one interface with multiple implementations.

Flashcard 63: What keyword is used to inherit from a class?

Answer: extends. Creates parent-child relationship between classes.

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

Answer: toString(). Provides readable format for object display.

Flashcard 65: Which access modifier allows visibility to all classes?

Answer: public. Provides unrestricted access from anywhere.

Flashcard 66: Identify the method that is automatically called when an object is created.

Answer: Constructor. Invoked immediately upon object instantiation.

Flashcard 67: What is an object in the context of Java?

Answer: An instance of a class containing fields and methods. A concrete realization of a class template.