Java: Cannot find symbol but typing is correct : <p>I made a class <code>Operator</code> and a method called <code>compare</code>. However, when call this method in my program, I always got error message </p>

<p><code>InfixToPostfix.java:17: error: cannot find symbol
                System.out.println(compare(op,op1));
                                   ^
  symbol:   method compare(Operator,Operator)
  location: class InfixToPostfix
</code></p>

<p>I think I did not make any spell mistakes.</p>

<pre><code>public class Operator extends Token {

    protected String val; //Modified by Qinjianhong Yang, 11/18/16

    public boolean isOperator() { return true; }
    public boolean isOperand() { return false; }

            // helper method, returns (assigns) precedence for operators
    protected int getPrec()
    {
            //modified by Qinjianhong Yang, 11/17/2016
            if(this.val.equals("+") || this.val.equals("-")){
                    return 1;
            }
            else return 2;

    }

            // handy for comparing 2 operators
    public static int compare( Operator a, Operator b )
    {
            if( a.getPrec() == b.getPrec() )
                    return 0;
            else if( a.getPrec() &lt; b.getPrec() )
                    return -1;
            else
                    return 1;
    }

    public String getVal() { return this.val; }

    public Operator( String v ) { this.val = v; }

} 
</code></pre>

<p>I call this function like this:</p>

<pre><code> Operator op = new Operator("+");
 Operator op1 = new Operator("*");
 System.out.println(compare(op,op1));
</code></pre>
