Results 1 to 2 of 2

Thread: stack class

  1. #1
    sharonk is offline Member
    Join Date
    Aug 2013
    Posts
    1
    Rep Power
    0

    Question stack class

    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

  2. #2
    AndrewM16921 is offline Senior Member
    Join Date
    Jan 2009
    Location
    NJ, USA
    Posts
    263
    Rep Power
    6

    Default 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.

Similar Threads

  1. Replies: 2
    Last Post: 01-14-2012, 08:56 PM
  2. Replies: 1
    Last Post: 10-06-2011, 02:26 PM
  3. Replies: 1
    Last Post: 11-17-2008, 09:32 AM
  4. Demonstration of Stack class in java.util package
    By Java Tip in forum java.lang
    Replies: 0
    Last Post: 04-16-2008, 10:33 PM
  5. How to use Stack class in java.util package
    By Java Tip in forum java.lang
    Replies: 0
    Last Post: 04-16-2008, 10:32 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •