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.

Instructions

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

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

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.