Derived d1 = new Derived(); What is printed as a result of executing the statement? A) Nothing is printed because the statement is a variable declaration. B) Base C) Derived D) Base Derived E) Derived Base

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter3: Using Methods, Classes, And Objects
Section: Chapter Questions
Problem 11RQ
icon
Related questions
Question

Consider the following classes.

 

public class Base

{

        public Base()

        {

                   System.out.print("Base" + " ");

         }

}

public class Derived extends Base

{

          public Derived()

          {

                   System.out.print("Derived" + " ");

          }

}

 

Assume that the following statement appears in another class.

 

         Derived d1 = new Derived();

 

What is printed as a result of executing the statement?

 

A) Nothing is printed because the statement is a variable declaration.

B) Base

C) Derived

D) Base Derived

E) Derived Base

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Systems Architecture
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning