14.6 Programming Activity 1: Writing Methods for a Stack Class

In this activity, you will work with a stack represented by an array, performing this activity:

Code the push and pop methods to insert onto and delete from a stack represented by an array of ints.

The framework will animate your code to give you feedback on the correctness of your code. It will display the state of the stack at all times. The result of your operation will be displayed, reflecting the value returned by your push or pop method. The items in the stack will be displayed in black while the array elements that are not part of the stack will be displayed in red.


Copy the contents of the Programming Activity 1 folder for this chapter from the companion ...

Get Java Illuminated, 5th Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.