title: Retrieve object from Java Vector by using its class name
body: <p>I will start by explaining the scenario.
  I have to create a Vector to hold a list of Circles.
  Then I create a circle object, and add it to the Vector.
  Finally I have to print the state of each circle in the list (the state isn't important to define, just it's colour and position etc).</p>
  
  <p>Basically my problem is, how do I hold the circles so that I can then pass in the name of one of them and it will print the correct circle's state. It may be clearer to show you my code.</p>
  
  <p>I have 3 classes, that main one called Lab83Test, the Vector one, called CircleList, and the Circle one, called Circle. (The formatting has gone weird and I can't fix it, so apologies!)</p>
  
  <p><strong>Lab83Test:</strong></p>
  
  <pre><code>public class Lab83Test {
  
      public static void main(String[] args) {
          makeNewCircle();
      }
      public static void makeNewCircle() {
          CircleList newList = new CircleList();
          Circle newCircle = new Circle();
          newList.addCircle(newCircle);
          newCircle.makeVisible();
          newList.printDetails();
      }
  }
  </code></pre>
  
  <p><strong>CircleList:</strong></p>
  
  <pre><code>import java.util.Vector;
  
  public class CircleList {
      private Vector circleVector;
  
      public CircleList() {
          circleVector = new Vector();
      }
      public void addCircle(Circle circleName) {
              circleVector.add(circleName);
              printDetails();
      }
      public void addCircleToPlace(Circle circleName, int pos) {
          circleVector.add(pos, circleName);
          printDetails();
      }
      public void removeCircleFromPos(int pos) {
          circleVector.remove(pos);
          printDetails();
      }
      public void removeAllCircles(int pos) {
          circleVector.clear();
          printDetails();
      }
      public void printDetails() {
  
      }
  }
  </code></pre>
  
  <p>The circle class isn't too important, and it has a lot of methods for moving the circle and stuff. The main thing is that it has to return its state.</p>