Answered step by step
Verified Expert Solution
Question
1 Approved Answer
DQuestion 1 1.5 pts What is polymorphism in Java? Check all that apply The occurrence of different forms among the members of a population or
DQuestion 1 1.5 pts What is polymorphism in Java? Check all that apply The occurrence of different forms among the members of a population or colony, or in the life cycle of a software program The ability for the same code to be used with several different types of objects, as long as the types belong to the same class hierarchy The ability of a primitive type such as a character to be typecasted to an integer The ability for the code to behave differently depending on the actual type of object used DQuestion 2 1.5 pts Which of the following statements are TRUE? Check all that apply O Polymorphism is possible because when the program reaches a particular call to an object's method, Java VM examines the actual object to see which method to call. Polymorphism is made possible in Java by the fact that reference variables can refer to subclass (descendant) objects On top of page 614, the code in EmployeeMain4.java, program line 3, allocates an array of Employee type that stores one object of Employee type, one of Lawyer type, one of Secretary type, and one of LegalSecretary Polymorphism is made possible in Java by the fact that reference variables can refer to superclass (ancestor) objects. The method printinfo on pp 611-612 expects an Employee type as a parameter, but it is possible to call this method with objects of other types, as long as these other types are Employee descendants. Question 3 1.5 pts Assuming the code presented in the Employee hierarchy in the textbook, which of the following code fragments are syntactically and logically correct? Check all that apply Secretary Is1-new Employee0: Secretary s1-new LegalSecretary0: s1.takeDictation("typing a legal brief"); Employee e1-new LegalSecretary0 e1.takeDictation("typing a legal brief"); Secretary s1-new LegalSecretary0 s1.ileLegalBriefs("typing a legal brief"); Question 5 1.5 pts Which of the following statements are TRUE? Check all that apply Backward compatibility is the ability of new code to work correctly with old code, without modifying the old code Suitability is the ability of an object of a subclass to be used successfully anywhere an object of the superclass is expected. The term is-a is used to describe class composition, whereas the term has-a is used to describe class inheritance. A connection between two objects where one has a field that refers to the other (e.g.Circle class on p 623 containing aPoint field) is called a has-a relationship. According to the textbook, the Point3D class should NOT inherit from Point due to the potential issues related to the equals method
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started