Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Part A: class A { A(int i) {} // 1 } class B extends A {} // 2 Which of the following statements are true?

Part A:

class A {

A(int i) {} // 1

} class B extends A {} // 2

Which of the following statements are true? Choose 2

a. The compiler attempts to create a default constructor for class A.

b. The compiler attempts to create a default constructor for class B.

c. Compile-time error at 1.

d. Compile-time error at 2.

Part B:

class A {A() throws Exception {}} // 1

class B extends A {B() throws Exception {}} // 2

class C extends A {C() {}} // 3

Which of the following statements are true? Choose 2.

a. class A extends Object.

b. Compile-time error at 1.

c. Compile-time error at 2.

d. Compile-time error at 3.

Part C:

Which of the following modifiers CANNOT be applied to the declaration of a field? Choose 2

a. abstract

b. final

c. private

d. protected

e. public

f. transient g const

Part D:

2 class A {

3 public static void main (String[] args) {

4 Error error = new Error();

5 Exception exception = new Exception();

6 System.out.print((exception instanceof Throwable) + ",");

7 System.out.print(error instanceof Throwable);

8 }

9 }

What is the result of attempting to compile and run the program? Choose 1.

a. Prints: false,false

b. Prints: false,true

c. Prints: true,false

d. Prints: true,true

e. Compile-time error

f. Run-time error

g. None of the above

Part E:

String d = beekeeper;

d.substring(1,7);

d = w + d;

d.insert(3,bee);

System.out.println(d);

What is the result?

a. wbeebeekeep

b. wbeekeeper

c. wbeekeepe

d. weekeeper

e. whoneyproducer

f. Compilation fails

g. An exception is thrown

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

Database Reliability Engineering Designing And Operating Resilient Database Systems

Authors: Laine Campbell, Charity Majors

1st Edition

978-1491925942

More Books

Students also viewed these Databases questions

Question

In an Excel Pivot Table, how is a Fact/Measure Column repeated?

Answered: 1 week ago