Thread: No output shown
View Single Post
  #1 (permalink)  
Old 07-08-2007, 06:36 PM
ai_2007 ai_2007 is offline
Member
 
Join Date: Jun 2007
Posts: 21
ai_2007 is on a distinguished road
No output shown
I have created a code to accept 10 integers into a stack and a queue and then print the output simultaneously removing items from both.

I can enter the inputs for both stack and queue, but there is no output shown.

Why is this and how can I resolve it?

Below is the code :

Code:
import javax.swing.*; import static javax.swing.JOptionPane.*; public class StacknQueue { public static void main(String args[]){ StackArrayBased stack = new StackArrayBased(); QueueArrayBased queue = new QueueArrayBased(); for(int i=0; i<11; i++){ stack.push(showInputDialog("Enter an integer into Stack :")); queue.enqueue(showInputDialog("Enter an integer into Queue : ")); } System.out.println("\n Numbers stored in Stack \n"); while((!stack.isEmpty())){ System.out.println((String)stack.pop()); } System.out.println("\n Numbers stored in Queue \n"); while((!queue.isEmpty())){ System.out.println((String)queue.dequeue()); } } }
Reply With Quote
Sponsored Links