title: Java The method is undefined for this type
body: <p>I am having a problem with calling a method that is in a different class. This <code>main</code> method is in a class on its own called <code>lab14</code>, and the <code>heapSort()</code> method is in a different class called <code>HeapSort</code>. Both of these classes are in the default package. I am getting the error "The method heapSort(Vector) is undefined for the type Lab14" and I don't understand why, please help.</p>
  
  <p>below is the main method in the lab 14 class</p>
  
  <pre><code>public static void main(String args[]) {
  
      Heap myheap = new Heap();
      Vector&lt;StudentGPA&gt; vec = new Vector();
      int []  br = new int[20]; 
      double []  dr = new double[20]; 
      int i = 0;
      int j = 0;
      try {
      //String inputLine; //stores each line from the file
      Scanner scanLine;
      Scanner input = new Scanner(new File("students.in"));
      while (input.hasNextLine()){
      scanLine = new Scanner(input.nextLine());
  
      int id = scanLine.nextInt();
      //br[i] = id;
      String name = scanLine.next();
      double gpa = scanLine.nextDouble();
      //dr[i]= gpa;
      //myStr.add(name);
      if(scanLine.hasNext())
      {
           String advisor = scanLine.next();
           GraduateStudentGPA grad = new GraduateStudentGPA(id,name,gpa,advisor);
           vec.add(grad);
      }
      else
      {
          StudentGPA reg = new StudentGPA(id,name,gpa);
          vec.add(reg);
      }
      i++;
      j++;
      }
      input.close();
  } 
  catch (IOException e) {
      System.out.println("IOException in reading input file!!!"+e);
  }   
  heapSort(vec);
  }
  </code></pre>
  
  <p>Below is the code for the HeapSort class</p>
  
  <pre><code>public class HeapSort &lt;E extends Comparable&lt;? super E&gt;&gt;{
  /** sorts the input vector using heap Sort &lt;ul&gt; &lt;li&gt; iterates
   * through each element of the input vector and inserts each
   * element to the heap by calling {\tt heapInsert}.  &lt;li&gt; deletes
   * each of the inserted items by calling {\tt heapDelete} the
   * appropriate number of times, and fills up the vector with the
   * returned elements.  &lt;/ul&gt; If you are using the
   * minheap implementation, this insertion and deletion of all
   * items will produce a list of items sorted by their key
   * attribute values.
   * @param vec input vector
   */
  public void heapSort(Vector&lt;StudentGPA&gt; vec){
      //  --  TO COMPLETE  --
      Heap myheap = new Heap&lt;E&gt;();
      for(int i = 0; i &lt;vec.size(); i++)
      {
          myheap.heapInsert(vec.elementAt(i));
      }
      for(int i = 0; i &lt;vec.size(); i++)
      {
          vec.setElementAt((StudentGPA) myheap.heapDelete(), i);
      }
  
  }
  
  
  }
  </code></pre>