Question
JAVA (in your own words plzzzz) 18. What is polymorphism? 19. What is dynamic binding? What is late binding? Give an example of each. 20.
JAVA (in your own words plzzzz)
18. What is polymorphism?
19. What is dynamic binding? What is late binding? Give an example of each.
20. Is overloading a method name an example of polymorphism?
21. In the following code, will two invocations of writeOutput produce the same output on the screen or not?
Person person = new Student("Sam", 999);
person.writeOutput();
person = new Undergraduate("Sam", 999, 1);
person.writeOutput()
22. In the following code which definition of writeOutput is invoked?
Undergraduate ug = new Undergraduate("Sam", 999, 1);
Personp = (Person) ug;
p.writeOutput()
23. imagine the class Oval that defines the methods getPerimeter and getAreabut does not have the clause implements Measurable. Could you pass an instance of Oval as an argument to the method display given in the previous section?
24. Can a class implement more than one interface?
25.Suppose class C implements the interface Trainable, as defined in the previous section. Can you pass an instance of C to a method whose parameter is of type Capable?
26. Suppose class D implements the interfaces Callable and Capable, as defined in the previous section. Can you pass an instance of D to a method whose parameter is of type Trainable?
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