OOP Concepts Flashcards
6 cards from real AMCAT practice questions. Tap to flip, then mark Knew It or Still Learning โ missed cards come back until you master them.
Read the first 6 OOP Concepts flashcards as text
What is a constructor in OOP?
Answer: A special method called automatically when an object is created
A constructor is a special method with the same name as the class, called automatically when a new object is created to initialize its state.
What does 'composition' mean in OOP?
Answer: A class contains an instance of another class as a field
Composition is a 'has-a' relationship: a class contains objects of other classes as member variables.
What is the purpose of the 'final' keyword when applied to a method in Java?
Answer: The method cannot be overridden in subclasses
A 'final' method cannot be overridden by any subclass.
Which OOP concept bundles data and the methods that operate on that data together in one unit?
Answer: Encapsulation
Encapsulation bundles data (fields) and methods (behaviors) together in a class and restricts direct access using access modifiers.
What is method overriding?
Answer: Redefining a superclass method in a subclass with the same signature
Method overriding occurs when a subclass provides a new implementation for a method defined in its parent class, using the same method signature.
In which memory area are objects allocated in Java?
Answer: Heap
In Java, objects created with 'new' are allocated in the heap. Local variables live on the stack.