Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Suppose you have an interface called ShakesHands with the following method listed in that interface: public void shakeHands (ShakesHands other); and three classes

 

1. Suppose you have an interface called ShakesHands with the following method listed in that interface: public void shakeHands (ShakesHands other); and three classes (Student, Teacher, Parent) all of which implement the ShakesHands interface, determine which of the following code fragments would compile: ShakesHands x = new ShakesHands(); ShakesHands x = new Student(); Student x = new ShakesHands(); Student x = new Teacher(); ShakesHands x; x = new Student(); x = new Teacher(); x = new Parent(); Teacher x = new Teacher(); Teacher y = new Teacher(); x.shakeHands (y); Student x = new Student(); Teacher y = new Teacher(); x.shakeHands (y); Parent x = new Parent(); String y = new String("Parent"); x.shakeHands (y); ShakesHands x = new Student(); x.shakeHands (x);

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

Principles of Incident Response and Disaster Recovery

Authors: Michael E. Whitman, Herbert J. Mattord, Andrew Green

2nd edition

1111138052, 9781285712628 , 978-1111138059

More Books

Students also viewed these Computer Network questions

Question

Find the investors expected profit.

Answered: 1 week ago