Pre-AP®CS Exposure Java / Exercises 09.01-06 / Date:
Name: / Period:

1. What are the 3 computer science features used by OOP?

2. What is the major contribution and motivation for developing programs with Object Oriented Design?

3. What is Encapsulation?

4. What are the 3 types of class interaction?

5. Refer to the previous question. Which is the main focus of this chapter?

6. What are Utility Classes?

7. Give 2 examples of utility classes which you have already been using for a while.

8. Why is OOP so popular?

9. What is inheritance?

10. In inheritance, the existing class is called the ______and the new class, which inherits the features of the existing class, is called the ______.

11. In computer science an is-a relationship involves ______.

12. In computer science a has-a relationship involves ______.

13. Give an example of an is-a relationship.

14. Give an example of a has-a relationship.

15. Look at program Java0901.java. Why does this program not compile?

Questions 16 through 19 involve program Java0902.java.

16. Which keyword in the heading of the Student class is used to specify that it inherits from the Person class?

17. Which class is the subclass?

18. Which class is the superclass?

19. tom is an object of the Student class, not the Person class. The Student class does not have a showAge method. Why is it that this line: tom.showAge(); does not cause a compile error?

20. When an object of a subclass is instantiated both the subclass constructor and the superclass constructors are called, but which one is called first?

21. Does a subclass have access to the private data from the superclass?

22. Does a subclass have access to the protected data from the superclass?

23. Can a class be both a subclass and a superclass?

24. Give an example of “Multi-Level Inheritance”. (This means inheritance with more than 2 levels.)

25. What is it called when one subclass has 2 or more superclasses?

26. Refer to the previous question. Is this feature available in Java? If not, then what language?

27. Inheritance makes changes in two fundamental ways. List them.

Exposure Java 2015, Pre-AP®CS Edition Exercises 09.01-06 Page 2 05-21-15