1. Is overloading a method name an example of polymorphism?
2. In the following code, will the two invocations of writeOutput produce the same output on the screen or not? (The relevant classes are defined in Listings 8.1, 8.2, and 8.4.)
Person person = new Student("Sam", 999);
person.writeOutput();
person = new Undergraduate("Sam", 999, 1);
3. In the following code, which definition of writeOutput is invoked? (The classes are defined in the previous case study.)
Undergraduate ug = new Undergraduate("Sam", 999, 1);
Personp = (Person) ug;
p.writeOutput();
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here