Nicola Alset wrote:YAs for your last note, that is the problem I have been struggling with. I am not sure how to display all of the integers that are currently in the array delimited by commas as push/pop interact with the array
Jeff Verdegan wrote:
Okay, but you know how for loops work, right? And you know what field1.setText() does, right?
So therefore, you must know, without seeing it or without me telling you, that this:
will just set the text of that field to the stop of the stack N times, where N is whatever value is on top of the stack.
Programming by guessing is not very effective.
You need to step away from the computer and think about how you would do this "manually", and write those steps down very clearly and precisely.
So you have a physical stack of cards, and each one has a number written on it, and you want to write those numbers down on a line on sheet of paper, with a comma between each pair of numbers.
You want to pretty much forget about Java for this exercise, but one thing you'll probably want to keep in mind is that setText() just sets the text to whatever you give it, replacing what was there before. Unless there's an "addText()" or somesuch method, you'll have to have the full string prepared ahead of time.