Java Reference
In-Depth Information
Self-Test Exercises (continued)
14. Modify the following class defi nition so it correctly implements the Cloneable
interface (all the new instance variables are shown):
public class PricedItem extends StockItem
{
private double price;
...
}
15. Modify the following class defi nition so it correctly implements the Cloneable
interface (all the instance variables are shown):
public class Record
{
private StockItem item1;
private StockItem item2;
private String description;
...
}
16. Modify the following class defi nition so it correctly implements the Cloneable
interface (all the new instance variables are shown):
public class BigRecord extends Record
{
private StockItem item3;
...
}
17. Modify the defi nition of the class Date ( Display 4.13 ) so it implements
the Cloneable interface. Be sure to defi ne the method clone in the style
of Display 13.7 .
18. Modify the defi nition of the class Employee ( Display 7.2 ) so it implements
the Cloneable interface. Be sure to defi ne the method clone in the style
of Display 13.8 .
19. Modify the defi nition of the class HourlyEmployee ( Display 7.3 ) so it
implements the Cloneable interface. Be sure to defi ne the method clone in
the style of Display 13.8 .
 
Search WWH ::




Custom Search