It's not a secret anymore!
The moose likes Beginning Java and the fly likes help!  trouble with pop method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "help!  trouble with pop method" Watch "help!  trouble with pop method" New topic

help! trouble with pop method

Russ Russ

Joined: Oct 21, 2002
Posts: 4
My applet is supposed to detect palindromes (words that are spelled the same forwards or backwords, ie "radar").
GUI is named WordGUI.
Stack class is named WordStack.
I am trying to use the pop() with stacks. I was able to use the push() without problems. Basically, I'm accepting user input from a textfield in my WordGUI class and pushing each char onto a stack array named data. Then I need to pop the chars out of the data array into a new stack array called popped. I then need to compare the contents of the 2 arrays to see if they are equal. If they are - we have detected a palindrome. Mission accomplished.
So... what am I doing wrong with my pop method? I think there's also a problem with my for loop that uses pop. Any ideas? Thank you.

[Dave fixed code tags]
[ October 22, 2002: Message edited by: Dave Vick ]
Dave Vick
Ranch Hand

Joined: May 10, 2001
Posts: 3244
I noticed that you also posted this to several other forums - that is called "cross posting". Cross posting is bad.
Most of the visitors here read more than one forum and it is frustrating to see the same question repeated over and over. You have a better chance of getting a correct and timely answer if you post it to the most appropriate forum instead of using the shotgun approach and hoping you'll hit something.

William Barnes
Ranch Hand

Joined: Mar 16, 2001
Posts: 986

Ya, this looks like it isn't going to work very well.

Please ignore post, I have no idea what I am talking about.
subject: help! trouble with pop method
jQuery in Action, 3rd edition