Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question 7: Determine which of the following method calls are valid using your knowledge of inheritance and the three classes below. public class Thought {
Question 7: Determine which of the following method calls are valid using your knowledge of inheritance and the three classes below. public class Thought \{ public void message() ( System.out.println("I feel like I'm diagonally parked " + "in a parallel universe."); \} public int thinkTime(int time)\{ return time*2; \} \} public class Advice extends Thought \{ public void message() \{ System.out.println("Warning: Dates in calendar " + "are closer than they appear."); System.out.println(); \} super.message(); \} public class Test \{ public static void main(String[] args)\{ Thought think = new Thought () ; Advice thinkAgain = new Advice (); think.message(); thinkAgain.message(); \} \} a. What is the output after the Test class is executed? b. Is the following instruction valid? int myTime = thinkAgain.thinkTime (5); c. Is the following instruction valid? int yourTime = think.thinkTime
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