File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Stack problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Stack problem" Watch "Stack problem" New topic
Author

Stack problem

Deepak Monster
Greenhorn

Joined: Mar 25, 2012
Posts: 3
hello,
i have been trying this stack problem using interface but not getting the desired output



OUPT:

Stack is full.
Stack is full.
The Stack1 is :
3
2
1
0
Stack is empty
0
The Stack2 is :
6
5
4
3
2

Please do reply
Thankx in advance
Zeeshan Sheikh
Ranch Hand

Joined: Nov 20, 2011
Posts: 144

Please check Line 66. You initialized your 2nd stack of size 8. You pushed 8 numbers in it and when its time to pop them you are running loop from 0 to 5. Change your loop condition for second stack output and you should have desired output.


MySQL Blog
http://mysqlearner.blogspot.com/
Hunter McMillen
Ranch Hand

Joined: Mar 13, 2009
Posts: 492

What is your desired output?

Hunter


"If the facts don't fit the theory, get new facts" --Albert Einstein
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Stack problem