title: Java vector<object> class method access
body: <p>I am trying to use a vector to hold my classes. These classes inherit methods from another class and have their own methods as well. What I am having trouble with is using the vector with objects to call the methods from the class within the object. I thought it would be something like:</p>
  
  <pre><code>public static void vSort(Vector&lt;Object&gt; vector) {
  vector[0].generate();
  }
  </code></pre>
  
  <p>with generate being a custom method i created with the student class within the object.</p>
  
  <p>A better example</p>
  
  <pre><code>public class Method {
  protected String name;
  
  public void method() {
  // some code
  }
  }
  public class Student extends Method {
  protected String last;
  
  public void setUp() {
  // some code
  }
  }
  public class Main {
  public static void main(String[] args) 
  {
  Vector&lt;Object&gt; vector = new Vector&lt;Object&gt;();
  Student stu = new Student(); // pretend this generates something
  
  vector.add(stu);
  
  }
  </code></pre>
  
  <p>The problem i am running into is there are many classes like student that build on Method. If i cant use Object that is fine with me but i need to access the code within the Method class.</p>