The constructor of the Car class requires a String parameter (color). A: Fails because there is no default constructor (Car() without arguments). C: Fails because new is required to instantiate objects in Java. D: Incorrect syntax.
Please select 2 correct answers
Encapsulation ensures that: Implementation details are hidden (achieved using private variables). Controlled access to class variables is provided through getters and setters. Making variables public (A) breaks encapsulation, and making methods static (D) is unrelated to encapsulation.
myDog is declared as Animal but instantiated as Dog. The overridden method makeSound() in the Dog class is called due to polymorphism.
Please select 3 correct answers
A: Overloading happens within the same class but with different parameter lists. B: Overriding occurs when a subclass modifies a method from its parent class. D: Overridden methods must have the same name, parameters, and return type. C is incorrect because overloaded methods must have the same method name.
Please select 3 correct answers
A: Abstract classes can have a mix of abstract and concrete methods. B: Abstract classes cannot be instantiated directly. D: A subclass must implement all abstract methods or be declared abstract itself. C is incorrect because an abstract class can have zero abstract methods.