Advertisement
Guest User

javavst

a guest
Feb 22nd, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.13 KB | None | 0 0
  1. 1. What does polymorphism mean?
  2. Many forms.
  3.  
  4. 2. Explain why the plus sign ( + ) is considered an overloaded operator?
  5. It can do more than one thing.
  6.  
  7. 3. Look at program Poly02.java. This program has 4 different drawSquare methods.
  8. How is this possible?
  9. The method identifiers all share the drawSquare identifier part, but then they arefollowed by four different set of parameters.
  10.  
  11. 4. Look at Poly04.java Which class is the Umbrella Class in this example?
  12. there is not an umbrella class and there is nopolymorphism
  13.  
  14. 5. Is Poly04.java a program that uses polymorphism?
  15. No it does not use polymorphism
  16.  
  17. 6. Look at Poly05.java Which class is the Umbrella Class in this example?
  18. The Language interface
  19.  
  20. 7. Program Poly06.java does not use polymorphism to select the correct greeting method.
  21. How does the program manage to execute correctly?
  22. It determines the class with a bunch of if statements
  23.  
  24. 8. The concept of the _______ _______is the foundation of polymorphism.
  25. Umbrela Class
  26.  
  27. 9. Does program Poly07.java use polymorphism?
  28. Yes
  29.  
  30. 10. What is the umbrella in Poly07.java?
  31. Language
  32.  
  33. 11. Compare programs Poly04.java and Poly07.java.
  34. What is different about the English, German, Dutch, and French classes in the second program?
  35. In the 2nd program, the 4 classes are all subclasses of Language.
  36.  
  37.  
  38. 12. Explain how program Poly07.java is using polymorphism.
  39. The ArrayList in this program stores Languages, and since English, German, Dutch, and French extend the Language class, there is no problem adding each of them to the ArrayList.
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46. 13. Explain how program Poly08.java is using polymorphism.
  47. The ArrayList in this program stores Languages, and since English, German, Dutch, and French extend the Language class, there is no problem adding each of them to the ArrayList.
  48.  
  49. 14. Is the Language umbrella used in one type of polymorphism only?
  50. No
  51.  
  52. 15. What is the different between a polymorphic method in an interface and a superclass?
  53. Interface cant hold polymorphism as well as superclass
  54.  
  55. 16. The program Beauty and the Beast is meant to demonstrate that there are reasons to use
  56. different type of umbrellas. What is recommended for Beauty and the Beast?
  57. A Superclass
  58.  
  59. 17. Why did you select the answer in question 16?
  60. How exactly do you handle the same process of the Beauty and the Beast program with an interface umbrella? The answer is also simple. You cannot do it. In an interface the act method will be abstract and each implementing class will define the act method for the first time and every class will have to include all those common details.
  61.  
  62.  
  63.  
  64. 18. How do you take advantage of the common act features that are defined in the act method of the umbrella superclass?
  65. It has a legitimate functionality at the superclass level used by all subclasses, before re-defining the act method.
  66.  
  67. 19. Why is an interface umbrella better for the language greeting programs?
  68. It implements each language without having to create a separate class for a similar method
  69.  
  70.  
  71. 20. Why is the Beauty and the Beast program and actual play a good example of polymorphism.
  72. The characters are using polymorphism
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement