Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

6. Analyze the following code. Numberl] numberArray- new integer121: numberArraylo)-new Double(1.5) Which of the following statements is correct? a. You cannot use Number as a

image text in transcribed
image text in transcribed
6. Analyze the following code. Numberl] numberArray- new integer121: numberArraylo)-new Double(1.5) Which of the following statements is correct? a. You cannot use Number as a data type since it is an abstract class. b. Since each element of numberArray is of the Number type, you cannot assign an Integer object to it. c. Since each element of numberArray is of the Number type, you cannot assign a Double object to it. d. At runtime, new Integer12) is assigned to numberArray. This makes each element of numberArray an Integer object. So you cannot assign a Double object to it. 7. Which of the following is a correct interface? a. interface A f void print ( b. abstract interface A (print();) c. abstract interface A ( abstract void print() :) d. interface A f void print0):) 8.is not a reference type. a. A class type b. An interface type C. An array type d. A primitive type 9. Which of the following statements are true? a. The String class implements Comparable. b. The Date class implements Comparable. c. The Double class implements Comparable. d. The Biginteger class implements Comparable. e. All of the above 10. The relationship between an interface and the class that implements it is a. Composition b. Aggregation c. Inheritance d. None 11. The output from the following code is java.util.Arrayist Strings list new java.util.ArrayListeString list.add("New York"l: java.util.ArraytisteString list1 java.util.ArrayList String list.clone list.add("Atlanta"l ist1.add( Dallas" System.out.printin/(list1) a. [New York) b. (New York, Atlanta c. [New York, Atlanta, Dallas] d. (New York, Dallas] 12. The GeometricObject and Circle classes are defined in this chapter. Analyze the following code Which statements are correct? public class Test public static void main(Stringl) args) ( GeometricObject x - new Circle(3) GeometricObject y = (Circle)(x-clone()); System.out.printin(x) System.out.printin(y): a. The program has a compile error because the clone() method is protected in the Object class. b. After you override the clonel) method and make it public in the Circle class, the problem can compile and run just fine, but y is null f Circle does not implement the Cloneable interface. c. To enable a Circle object to be cloned, the Circle class has to override the clonel) method and implement the java.lang.Cloneable interface. d. If Geometricobject implements Cloneable and Circle overrides the clonel) method, the clone method will work fine to clone Circle objects e. All of the above. 13. Which of the following statements is false? a. If you compile an interface without errors, a class file is created for the interface b. If you compile a class without errors but with warnings, a class file is created. c. If you compile a class with errors, a class file is created for the class. d. If you compile an interface without errors, but with warnings, a class file is created for the interface

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_2

Step: 3

blur-text-image_3

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

Medical Image Databases

Authors: Stephen T.C. Wong

1st Edition

1461375398, 978-1461375395

More Books

Students also viewed these Databases questions

Question

Explain the nature of human resource management.

Answered: 1 week ago

Question

Write a note on Quality circles.

Answered: 1 week ago

Question

Describe how to measure the quality of work life.

Answered: 1 week ago