Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

help! trouble with pop method

 
Russ Russ
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Russ
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.
thanks
 
William Barnes
Ranch Hand
Posts: 986
Eclipse IDE Firefox Browser Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Ya, this looks like it isn't going to work very well.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic