Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2 Is the following statement true or false? Justify your answer. All Java interfaces are abstract classes, but not all abstract classes are Java interfaces.

2 Is the following statement true or false? Justify your answer. All Java interfaces are abstract classes, but not all abstract classes are Java interfaces.

image text in transcribed

What is the running time of the following loop nest?

for(int i = 0; i 0; j--)

System.out.println("hello world");

Fill in exactly one choice.

logarithmic

linear NlogN quadratic

cubic

3. (12 points) Given the following class definition fragments and class instantiations, complete the table below. Assume that the methods shown here do not appear in any other classes. (E.g., The Restaurant class does not define a toString method.) class Building { public Point getLocation() ... } class Restaurant extends Building { public int getSeatCount() ...] class Lab extends Building { public String toString() ...] class Diner extends Restaurant { public boolean equals(Object other) ... } 5. (20 points item in an (a) Give to letter Lab 1 = new Lab(); Restaurant r = new Diner(); Building b = 1; Object o = r; In each blank cell, indicate what would happen if the method in each column is invoked with the object obj in each row. Choose (only one) from the following: compiler error runtime error (i.e., an exception is thrown) X, where X is the class from which the method is called The first row has been done for you, as a example. obj obj.getLocation() obj.getSeatCount() obj.toString() obj.equals(obj) b Building compiler crror Lab Object (b) Briefly o which

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

Spatial Databases A Tour

Authors: Shashi Shekhar, Sanjay Chawla

1st Edition

0130174807, 978-0130174802

More Books

Students also viewed these Databases questions