Answered step by step
Verified Expert Solution
Question
1 Approved Answer
number 11 please explain it An interface is designed to represent an athlete. An athlete has a name and a sport. The class heading is
number 11 please explain it
An interface is designed to represent an athlete. An athlete has a name and a sport. The class heading is as follows. public interface Athlete Which of the following will result in a compiler error if included in the interface. private String myname; private String mySport; public Athlete (string name, string sport)} myName = name; mySport = sport; public string getName (); public string getsport e (); a. I and II only b. I, II, III c. III only d. Only e. II only Which of the following pairs is not inheritance (is-a) relationship? a. Student, Person b. Car, Vehicle c. Car, Tire d. Sedan, Car e. Violin, Instrument Which of the following expressions tests whether the object cat belongs to the type Animal? a. (cat belongsTo Animal) b. (cat instanceof Animal) c. cat implements Animal d. (Animal contains cat) e. (Animal instanceof cat) Suppose an Employee class contains a method setName to set the value of an Employee object's instance variable name, plus a method getName to access the value of name. Consider the following code fragment: Employee e1 e2; e1 = new Employee (); e2 = new Employee (); e1. setName ("Sally"); e2. setName ("Jane"); e2 = e1; e2. setName ("Martha"); System. Out. printIn (e1. getName ()); What would be displayed on the console? a. Sally b. Jane c. Martha d. nullStep 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