|SOLUTION 16.1||Many answers are possible, but toString() is probably the most commonly used method that creates a new object. For example, the following code creates a new String object:
String s = new java.util.Date().toString();
The creation of strings often happens behind the scenes. Consider:
This method creates a String object from the Date object, ultimately by calling the toString() method of class Date. It is interesting to walk through this in debugger, to see the details of what happens within a common print() method.
Another method that creates a new object is clone(). You may discover other methods that are “factories” for creating objects without necessarily exemplifying ...