Chapter 11
-
Exercise 11.10 (Implement MyStack using inheritance) In Listing 11.10, MyStack is implemented using composition. Define a new stack class that extends ArrayList. Implement MyStack as the UML diagram provided. Write a test program that prompts the user to enter five strings and displays them in reverse order.
-
Exercise Casting: Implement this exercise in the package: myPkg.casting. Write a program that creates an ArrayList and adds a Circle object, a Date object, a string, and a Rectangle object to the list, and use a loop to display the radius, the date, and the height from each object.