i m quite new to java programming...pls tell me the mistake in the following programme...
class CharStack{ /*Declaration of member variables*/ char[]stackArray; int topOfStack; /*constructor*/ public void charstack(int capacity){ stackArray=new char[capacity]; topOfStack=-1; } /*member methods*/ public void push(char element){ stackArray[++topOfStack]=element; } public char pop(){ return(stackArray[topOfStack--]); } public boolean isEmpty(){ return topOfStack<0; } public char peek(){ return stackArray[topOfStack]; } public boolean isFull(){ return topOfStack==stackArray.length-1; } } public class Client{ CharStack stack=new CharStack(50); int i; int length=str.length(); BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); System.out.println("Enter a string:"); String str=br.readLine(); System.out.println("Original string:"+str); for(int i=0;i<length;i++){ stack.push(str.charAt(i)); } System.out.pritnln("Reversed string:"); while(!stack.isEmpty()){ System.out.print(stack.pop()); } System.out.println(); }