Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribednumber 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. null

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

Step: 3

blur-text-image

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

Online Market Research Cost Effective Searching Of The Internet And Online Databases

Authors: John F. Lescher

1st Edition

0201489295, 978-0201489293

Students also viewed these Databases questions