How to get back the vector?


EJB programming & troubleshooting: How to get back the vector?

  1. How to get back the vector? (2 messages)

    How do I get back a vector? I tried:

    import oz.*;
    Iterator v = getVector();
    //but it gives me error says:
    Method getVector not found in this class.

    Then i tried:
    Iterator v = oz.getVector();
    //the error is:
    Undefined variable, class, or package name: oz

    under directory oz/, I have:

    private Vector cart = new Vector();
    public Memory(String id) { = id;

    public Iterator getVector() {
       return cart.iterator();
  2. How to get back the vector?[ Go to top ]

    The method <code>getVector()</code> has been defined as a member operation, that is, a method belonging to an instance, an object, instead of a class.
    A member operation shall only be called referring to an instance, e.g. <code>myObj.getVector()</code>.
    So, in order for the first code block to work, the <code>Iterator v = getVector()</code> must be located within one of the <code>checkout</code> classes member operations.
  3. How to get back the vector?[ Go to top ]

    This is what you need to do :

    Checkout checkoutObj = new Checkout();
    Vector v = checkoutObj.getVector();

    This is because getVector is a member method of the Checkout class .