title: infix to postfix conversion program(java)
body: <p>I was working on a infix to postfix program(using stacks) but after all those efforts, something went wrong somewhere.I am getting the output as infix without conversion, please check if my intopost method is correct or not. </p>
  
  <pre><code>    //stack class also containing the intopostfix method
     import java.util.*;
      public class Stack 
      {   int i,j;
  char postfix[];
  char stack[];
  int top;
  String post;
  public Stack(int n)
  {
      stack=new char[n];
      top=-1;
  }
  public void push(char item)
  {
      if(top&gt;=stack.length)
          System.out.println("Stack overflow");
      else
      {
          stack[++top]=item;
      }
  }
  public char pop()
  {
      if(top==-1)
      {       System.out.println("Stack underflow");
              return 0;
      }
      else
          return stack[top--];
  }
  boolean isAlpha(char ch)
  {
      if((ch&gt;='a'&amp;&amp;ch&lt;='z')||(ch&gt;=0&amp;&amp;ch&lt;='9'))
          return true;
      else 
          return false;
  
  }
  boolean isOperator(char ch)
  {
      if(ch=='+'||ch=='-'||ch=='*'||ch=='/')
          return true;
      else return false;
  
  }
  
  void intopost(String str)
  {
      postfix=new char[str.length()];
      char ch;
  
      j=0;
  
      for(i=0;i&lt;str.length();i++)
      {
          ch=str.charAt(i);
          if(ch=='(')
              push(ch);
          else if(isAlpha(ch))
          {
              postfix[j++]=ch;
          }
          else if(isOperator(ch))
          {
              push (ch);
          }
          else if(ch==')')
          {
              while((pop())!='(')
                      {
                          postfix[j++]=pop();
                      }
          }
  
      }
  
  }
  void disp()
  {
      for(i=0;i&lt;postfix.length;i++)
      {   
          System.out.print(postfix[i]);
      }
  }
  }
  </code></pre>