Java: Cannot access methods from a different class : <p>First Class: Graph.java</p>

<pre><code>public class Graph {

    public void generateGraph(int VertexNum, int numOfEdges) throws ZeroVerticesException, DisjointGraphException{
        //Statements
    }
    //More methods    
}
</code></pre>

<p>Second class : prims.java</p>

<pre><code>public class prims {

    Graph g=new Graph();

    g.generateGraph(10,20); // Error here

}
</code></pre>

<p>The error shows as: "Syntax error, insert ")" to complete MethodDeclaration"</p>

<p>Why can't i access the method after creating an instance of graph ?</p>
