Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Questions 9 and 10 refer to the following code: public abstract class Phone { abstract void dial(); } public class MobilePhone extends Phone { }

Questions 9 and 10 refer to the following code:

public abstract class Phone { abstract void dial(); } public class MobilePhone extends Phone { } public class RotaryPhone extends Phone { public void dial () { //code not shown } } 

Which of the following statements is true?

Neither can be instantiated since they do not include constructors.

Neither can be instantiated since you cannot extend an abstract class.

MobilePhone can be instantiated.

RotaryPhone cannot be instantiated.

RotaryPhone can be instantiated.

Which of the following statements is true?

A Phone object can access methods in MobilePhone.

A RotaryPhone object can access methods in MobilePhone.

RotaryPhone inherits from Phone and MobilePhone.

RotaryPhone inherits from Phone.

None of the answers listed.

Suppose a class implements the Comparable interface. Which of the following methods must the class include?

charAt

substring

compareTo

length

indexOf

Questions 12-14 refer to the following:

public class A { public A () { System.out.print(one ); } public A (int z) { System.out.print(two ); } public void doStuff() { System.out.print(six ); } } public class B extends A { public B () { super (); System.out.print(three ); } public B (int val) { super (val); System.out.print(four ); } } 

What is printed when the following line of code is executed?

B b = new B();

three two

one three

four two

two four

one four

What is printed when the following line of code is executed?

A a = new B(5);

two

four

one

four one

two four

Assume that variable b has been instantiated as a B object. What is printed when the following line of code is executed?

b.doStuff();

two

five

four

three

six

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

Professional SQL Server 2000 Database Design

Authors: Louis Davidson

1st Edition

1861004761, 978-1861004765

More Books

Students also viewed these Databases questions