Presentation is loading. Please wait.

Presentation is loading. Please wait.

Interface, Subclass, and Abstract Class Review

Similar presentations


Presentation on theme: "Interface, Subclass, and Abstract Class Review"— Presentation transcript:

1 Interface, Subclass, and Abstract Class Review
Mr. Crone

2 True/False Interfaces can be instantiated.

3 True/False Interfaces can be instantiated. FALSE

4 True/False Interfaces can contain instance variables.

5 True/False Interfaces can contain instance variables. FALSE

6 True/False The statement below could be placed in an interface without error. public void setSide(double side){ }

7 True/False The statement below could be placed in an interface without error. public void setSide(double side){ } FALSE

8 True/False Assuming that Red is an interface, the code below will cause an error. Red r1;

9 True/False Assuming that Red is an interface, the code below will cause an error. Red r1; False

10 True/False Assuming that Car is an interface and Hybrid is an implementing class, the instantiation below will cause an error (you may assume that a default constructor for Hybrid exists). Car c = new Hybrid();

11 True/False Assuming that Car is an interface and Hybrid is an implementing class, the instantiation below will cause an error (you may assume that a default constructor for Hybrid exists). Car c = new Hybrid(); False

12 Vocabulary If more than one class implements an interface, its methods are said to be __________ ?

13 Vocabulary If more than one class implements an interface, its methods are said to be polymorphic.

14 True/False Class A implements Interface C. Class B extends Class A. Therefore, Class B also implements Interface C.

15 True/False Class A implements Interface C. Class B extends Class A. Therefore, Class B also implements Interface C. True

16 True/False Class A implements interface D. Classes B and F also implement interface D. Therefore, either B or F must be the subclass of A.

17 True/False Class A implements interface D. Classes B and F also implement interface D. Therefore, either B or F must be the subclass of A. False

18 In a UML diagram, how is the implements relationship shown?

19 In a UML diagram, how is the implements relationship shown
In a UML diagram, how is the implements relationship shown? A dotted line connecting the interface with the implementing class.

20 What is the exact spelling and capitalization of the operator used to determine how an object was instantiated?

21 What is the exact spelling and capitalization of the operator used to determine how an object was instantiated? instanceof

22 Vocabulary _________is the process by which a subclass can reuse attributes and behavior defined in a superclass

23 Vocabulary Inheritance is the process by which a subclass can reuse attributes and behavior defined in a superclass

24 Vocabulary What is the vocabulary term for providing new code for a method that is already located in a superclass?

25 Vocabulary What is the vocabulary term for providing new code for a method that is already located in a superclass? Overriding a method

26 Vocabulary What is the term for using the same method name but accepting different parameters

27 Vocabulary What is the term for using the same method name but accepting different parameters Overloading

28 The UML diagram below provides an example of what type of relationship?

29 The UML diagram below provides an example of what type of relationship
The UML diagram below provides an example of what type of relationship? Dependency

30 The UML Diagram below describes what type of relationship?

31 The UML Diagram below describes what type of relationship?

32 An “is-a” relationship is an informal way of describing what two relationships?

33 An “is-a” relationship is an informal way of describing what two relationships? Implements Extends

34 What is the informal way of describing the Aggregation relationship?

35 What is the informal way of describing the Aggregation relationship
What is the informal way of describing the Aggregation relationship? “has-a”

36 There are two significant differences between abstract classes and concrete classes. State the two significant differences.

37 There are two significant differences between abstract classes and concrete classes. State the two significant differences. Abstract classes cannot be instantiated. Abstract classes can contain abstract methods.

38 What does UML stand for?

39 What does UML stand for? Unified Modeling Language

40 Class A implements Interfaces B and C
Class A implements Interfaces B and C. Class A has two Class D objects for instance variables. Class E extends Class D. Draw the UML Diagram for the situation described above. Include the Object Class

41 Class Object Interface B Interface C Class A 2 Class D Class E


Download ppt "Interface, Subclass, and Abstract Class Review"

Similar presentations


Ads by Google