Bruce Eckel’s Thinking in Java | Contents | Prev | Next |
- Create
two classes,
A
and
B,
with default constructors (empty argument lists) that announce themselves.
Inherit a new class called
C
from
A,
and create a member
B
inside
C.
Do not create a constructor for
C.
Create an object of class
C
and observe the results. - Modify
Exercise 1 so that
A
and
B
have constructors with arguments instead of default constructors. Write a
constructor for
C
and perform all initialization within
C’s
constructor. - Take
the file
Cartoon.java
and comment out the constructor for the
Cartoon
class. Explain what happens. - Take
the file
Chess.java
and comment out the constructor for the
Chess
class. Explain what happens.