Virtual Developer Workshop: Containerized Development with Docker
|Bruce Eckel's Thinking in Java||Contents | Prev | Next|
- Create a class with a default constructor (one that takes no arguments) that prints a message. Create an object of this class.
- Add an overloaded constructor to Exercise 1 that takes a String argument and prints it along with your message.
- Create an array of object handles of the class you created in Exercise 2, but don’t actually create objects to assign into the array. When you run the program, notice whether the initialization messages from the constructor calls are printed.
- Complete Exercise 3 by creating objects to attach to the array of handles.
- Experiment with Garbage.java by running the program using the arguments “before,” “after” and “none.” Repeat the process and see if you detect any patterns in the output. Change the code so that System.runFinalization( ) is called before System.gc( ) and observe the results.