Search:

Type: Posts; User: sim18

Search: Search took 0.11 seconds.

  1. Replies
    10
    Views
    2,117

    Re: Java Stacks question

    Thanks very much for your help :)
  2. Replies
    10
    Views
    2,117

    Re: Java Stacks question

    {1, 2, 3, 4, 5}

    n = 3

    nth element = 3rd element in stack, which is 3.

    So you would pop() three times leaving {4,5}.

    If it was j it would be exactly the same then? i.e
  3. Replies
    10
    Views
    2,117

    Re: Java Stacks question

    Thanks very much for the replies :)

    I have added print statements and I can see exactly what is going on!

    If I was going to take this one step further, (given integer 'n') and set j to the nth...
  4. Replies
    10
    Views
    2,117

    Re: Java Stacks question

    It created two stacks s & s2.

    I then added s.push("n"); and s.push("m"); giving n & m in the stack1.... is this about right so far?

    thanks
  5. Replies
    10
    Views
    2,117

    Re: Java Stacks question

    Yes this is a different question. How would I go about making a program that does what I want?

    Creating my stacks (s) and (s2) - Stack s = new Stack();
    ...
  6. Replies
    10
    Views
    2,117

    Java Stacks question

    Hi everone, I have been doing java for around a year now :)
    I'm not looking for somebody to give me an answer but for guidance and help.

    This is the question:

    I have a stack called 's'....
Results 1 to 6 of 6