This content has been marked as final. Show 4 replies
Hi everyone, I posted a similar question earlier and thought I got the response I wanted but I keep running into problems.
I'm looking to make my own version of the stack ADT using arrays (or arraylist).
I have created my own isEmpty() method. Here is part of my code:
No - you haven't. There is no 'isEmpty' method in the code you posted.
We can't debug code that we can't see. You haven't posted any interface and you haven't posted anything that calls any of the limited code that you did post.
You did post code that tries to call the method on the class instead of an instance of the class.
Sorry, I'll edit it with the isEmpty() method inside. (I have an index at the beginning and I keep track of it with every push/pop operation) Also, about the code that tries to call the class itself, and not an instance, should I make an instance of the class inside the class itself at the beginning? Can I do that?
Actually I think I got it, is the answer simply to write if (isEmpty())? without any class preceding it?
Edited by: Tiberiu on Mar 1, 2013 6:37 PM