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 TerminalIO.*; class Stack{ private char stk[]; private int top; public Stack(){ stk=new char[10]; top=-1; } public boolean isEmpty(){ return top==-1; } public boolean isFull(){ return top==stk.length-1; } public void push(char item){ if(isFull()){ System.out.println("Stack is Full");} else{ stk[++top]=item; } } public char pop(){ char c=' '; if(isEmpty()){ System.out.println("Stack is Empty"); return c; } else{ return stk[top--]; // top--; } } public void printStack(){ if(isEmpty()){ System.out.println("Stack is empty");} else{ for(int i=top;i>=0;i--) System.out.print(stk[i]+" "); } } } class Reverse{ public static void main(String args[]){ Stack st=new Stack(); KeyboardReader input=new KeyboardReader(); String S=input.readLine("Enter text Here : "); for(int i=0; i