Answered step by step
Verified Expert Solution
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
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