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