Results 1 to 2 of 2
  1. #1
    cups is offline Member
    Join Date
    Dec 2011
    Rep Power

    Default Help trying to work with stack?

    Hey there!

    I am trying to use a stack. I want to push an object nussinovZelle on it.
    A nussinovZelle has several attributes, such as int row and int column.
    I print out the nussinovZelle and it works fine, no null pointer exception.
    I put it on the stack (stack.push(nz);) and get it again into another nussinovZelle
    mz = (nussinovZelle) stack.pop();
    now that still works out. if I try to get the rows mz.getRow() or the columns mz.getColumn()
    I'm getting a null pointer exception.
    I do not know why. the Stack was declared as: Stack<nussinovZelle> stack = new Stack<nussinovZelle>();

    can someone help out please? I really need this to work!!

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Voorschoten, the Netherlands
    Blog Entries
    Rep Power

    Default Re: Help trying to work with stack?

    Can you show us the relevant code?

    kind regards,

    Build a wall around Donald Trump; I'll pay for it.

Similar Threads

  1. Stack help. Why will my peekAtTop() not work??
    By MoozicFarm in forum New To Java
    Replies: 4
    Last Post: 03-27-2012, 11:43 PM
  2. Replies: 2
    Last Post: 01-14-2012, 09:56 PM
  3. applet call dll work in Win2000 but not work in WinXP
    By manhcuongtin4 in forum Java Applets
    Replies: 1
    Last Post: 07-14-2011, 02:45 PM
  4. Stack Overflow work around?
    By Coukapecker in forum New To Java
    Replies: 2
    Last Post: 03-14-2010, 09:49 PM
  5. How to set a stack size. -Xss doesn't work
    By protonus in forum New To Java
    Replies: 4
    Last Post: 06-27-2008, 07:59 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