Java Reference
In-Depth Information
14. Given the following Vehicle and Car class definitions:
1. package my.vehicles;
2.
3. public class Vehicle {
4. public String make;
5. protected String model;
6. private int year;
7. int mileage;
8. }
1. package my.vehicles.cars;
2.
3. import my.vehicles.*;
4.
5. public class Car extends Vehicle {
6. public Car() {
7.
8. }
9. }
which of the following statements can appear on line 7 so that the Car class compiles
successfully? (Select all that apply.)
A. make = “Honda“;
B. model = “Pilot“;
C. year = 2009;
D. mileage = 15285;
E. None of the above
15. What is the result of the following code?
1. public class Browser {
2. public static void main(String [] args) {
3. Browser b = new Firefox();
4. IE e = (IE) b;
5. e.go();
6. }
7.
8. public void go() {
9. System.out.println(“Inside Browser”);
10. }
11. }
Search WWH ::




Custom Search