Answered step by step
Verified Expert Solution
Link Copied!

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 {

image text in transcribed 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Object Oriented Databases Prentice Hall International Series In Computer Science

Authors: John G. Hughes

1st Edition

0136298745, 978-0136298748

More Books

Students also viewed these Databases questions