Select The Lesson:
Welcome to Online Education Of Sri Lanka
/*eduLanka Online education web site of Sri Lanka -------- w w w . e d u L a n k a . c o m ------------ java programs for University students - who follow courses - BIT - SLIIT and more find more lessons in http://www.it.edulanka.com eduLanka@gmail.com this programs under GNU licence */ import java.io.*; import TerminalIO.*; class QueueLt{ ListNode front; ListNode rear; ListNode newnode; public QueueLt(){ front=rear=null; } public boolean isEmpty(){ return front==null; } public void enQueue(Object x){ newnode=new ListNode(x); if(isEmpty()) front=rear=newnode; else{ rear.next=newnode; rear=newnode; } } public Object deQueue(){ Object ele="Error"; if(isEmpty()) System.out.println("Queue is Empty"); else{ ele=front.element; front=front.next; } return ele; } public void displayList(){ ListNode current=front; if(isEmpty()) System.out.println("Queue is Empty"); else while(current!=null){ System.out.println(current.element+" "); current=current.next; } } } public class QueueList{ public static void main(String []arg){ int num; String S=" "; QueueLt myque=new QueueLt(); KeyboardReader input=new KeyboardReader(); S=input.readLine("Enter Your Text : "); for(int i=0;i