Which two statements, if either were true, would make the code compile? (Choose two.)
Vehicle is an interface that is implemented by the Motorcycle class.
Vehicle and Motorcycle both implement the Transportation interface
Vehicle is a superclass of Motorcycle.
Motorcycle is a superclass of Vehicle.
Vehicle and Motorcycle both extend the Transportation superclass.
Motorcycle is an interface that implements the Vehicle class.
Correct answer: AC
Question 3
What is the name of the Java concept that uses access modifiers to protect variables and hide them within a class?
Encapsulation
Inheritance
Abstraction
Instantiation
Polymorphism
Correct answer: A
Explanation:
Using the private modifier is the main way that an object encapsulates itself and hide data from the outside world. Reference: http://www.tutorialspoint.com/java/java_access_modifiers.htm
Using the private modifier is the main way that an object encapsulates itself and hide data from the outside world.