title: java.lang.Float cannot be cast to java.lang.String infix to postfix
body: <p>I have problem concerning evaluating postfix expression using stack</p>
  
  <pre><code>for(int i=0;i&lt;postfix.length;i++){
    System.out.println("iteration:"+(i+1));
    if(postfix[i].equalsIgnoreCase("+") || postfix[i].equalsIgnoreCase("-") 
        || postfix[i].equalsIgnoreCase("*") || postfix[i].equalsIgnoreCase("/") ) {
      num1 = Float.parseFloat((String)out.pop());
      System.out.println("pop:"+num1);
      num2 = Float.parseFloat((String)out.pop());
      System.out.println("pop:"+num2);
      if(postfix[i].equalsIgnoreCase("+")) { 
        temp = num2+num1; 
        out.push(temp);
        System.out.println("push:"+temp);
        }
      else if(postfix[i].equalsIgnoreCase("-")) {   
        temp = num2-num1;   
        out.push((""+temp));
        System.out.println("push:"+temp);
        }
      else if(postfix[i].equalsIgnoreCase("*")) {   
        temp = num2*num1;   
        out.push((""+temp));
        System.out.println("push:"+temp);
        }
      else if(postfix[i].equalsIgnoreCase("/")) {
        temp = num2/num1;
        out.push((""+temp));
        System.out.println("push:"+temp);
        }
    }
    else{
      System.out.println("push:"+postfix[i]);
      out.push(postfix[i]);
    }
  }
  </code></pre>
  
  <p>the code works well if i only do operation among two numbers e.g "2 4 +"
  but when it becomes like "2 4 + 5 +" the error suddenly appears.. i even put markers.. the prints there to check the flow of my code ..thanks
  any help?</p>