| Author |
toString
|
Dustin Schreader
Ranch Hand
Joined: May 25, 2009
Posts: 74
|
|
I'm trying to make a toString to display my stack but i'm getting incompatible types. its the method starting on 106.
|
 |
fred rosenberger
lowercase baba
Bartender
Joined: Oct 02, 2003
Posts: 10043
|
|
should line 108 be
(missing the parens)
|
Never ascribe to malice that which can be adequately explained by stupidity.
|
 |
Dustin Schreader
Ranch Hand
Joined: May 25, 2009
Posts: 74
|
|
I sure do feel silly now thank you
|
 |
Dustin Schreader
Ranch Hand
Joined: May 25, 2009
Posts: 74
|
|
although When it prints out in gui it only prints out 1 item of the stack what I would like it to do is keep printing out the entire stack such as
4
3
2
n
t
So you can see every element in the stack, this is what i'm using in my gui to print it out at the moment.
outputStackTF.setText(myStack.toString());
|
 |
fred rosenberger
lowercase baba
Bartender
Joined: Oct 02, 2003
Posts: 10043
|
|
I've just barely skimmed your code, so i may not be correct. But it looks to me like in your public String toString() method, you are only calling the toString() method on the top element...therefore, it only prints what is in the top element.
What you would need to do is write some code that reads each element in the stack and calls IT'S toString() method.
|
 |
 |
|
|
subject: toString
|
|
|