Consider the following code segment and three classes. Hybrid prius = new Hybrid(); public class Engine public Engine() System.out.println("Executing the Engine constructor"); public class Car private Engine engine; public Car() System.out.println("Executing the Car constructor"); engine = new Engine(); public class Hybrid extends Car public Hybrid() System.out.println("Executing the Hybrid constructor"); What is printed as a result of executing the code segment?
1) An Exception error message.
2) Executing the Engine constructor
3) Executing the Hybrid constructor
4) Executing the Car constructor
5) Executing the Engine constructor
Executing the Hybrid constructor
6) Executing the Hybrid constructor
Executing the Car constructor
7) Executing the Hybrid constructor



Answer :

Other Questions