Experiment with a simple derivation relationship between two classes. Put println statements in constructors of both the parent and child classes. Do not explicitly call the constructor of the parent in the child. What happens? Why? Change the child's constructor to explicitly call the constructor of the parent. Now what happens?

What will be an ideal response?


When a parent's constructor is explicitly called, its program statements are executed as expected. But even in the absence of an explicit call, the parent's constructor is called when the child class is instantiated. An explicit call allows the child to pass parameters, allowing the parent to set up its contribution to the child's state. Without an explicit call, the default constructor is called, without parameters.

Computer Science & Information Technology

You might also like to view...

Interface Stream (package java.util.stream) is a generic interface for performing stream operations on objects. The types of objects that are processed are determined by the Stream’s ________.

a. root b. origin c. source d. start

Computer Science & Information Technology

A Windows 7 system repair disc can be created using the Backup and Restore utility.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

A value that can be changed is referred to as a(n) ________

A) operator B) join C) parameter D) expression

Computer Science & Information Technology

Using the mouse is a quick and easy method of adjusting a column width or row height when you do not need an exact width or height.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology