The practise exercise goes like this:
1.write java code that show how a word can be stored as a stack and reversed.
2. when a user runs the program, the program should ask the user to type in a work and when the Enter key is pressed, the word should be displayed with the letters in reverse.
3. way in which code works involves the stack being used to reverse the letters. first character are extracted one by one from the input string and pushed onto the stack. then they are popped off the stack and displayed. Because of its
last-in-first characteristics, the stack reverses the order of the characters.
:( please help with this practice questions im still new on java:(emo):
Re: stack class
Firstly, do you know what a stack is? If not, you definitely need to look into that data structure before you can do this problem.
There is a java class called Stack (which extends Vector), so I would also suggest looking into that.
Once you have those things straight, it may help to ask some more specific questions that we can answer.