generics; cannot find symbol; using wildcard - Help

This is a discussion on generics; cannot find symbol; using wildcard - Help ; code borrowed/inspired from/by DriverCatDog.java [6:1] cannot find symbol symbol : variable dogs location: class DriverCatDog java.util.Vector pets = dogs; ^ 1 error Errors compiling DriverCatDog. public class DriverCatDog { java.util.Vector pets = dogs; }//DriverCatDog Mammal.java is abstract, Cat.java and Dog.java ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: generics; cannot find symbol; using wildcard

  1. generics; cannot find symbol; using wildcard

    code borrowed/inspired from/by


    DriverCatDog.java [6:1] cannot find symbol
    symbol : variable dogs
    location: class DriverCatDog
    java.util.Vector pets = dogs;
    ^
    1 error
    Errors compiling DriverCatDog.


    public class DriverCatDog {
    java.util.Vector pets = dogs;
    }//DriverCatDog


    Mammal.java is abstract, Cat.java and Dog.java extend Mammal.java. What is
    "dogs", plural and lowercase? the reference to the Vector is pets? is it a
    vector or generic vector, btw?

    thanks,

    Thufir Hawat
    for rest of code

  2. Re: generics; cannot find symbol; using wildcard

    compiles, but netbeans underlines most of it in red; what do these
    statements do, please? shooting in the dark..

    public class DriverCatDog {

    public static void main(String[] args){
    System.out.println("DriverCatDog main..");

    java.util.Vector dogs = new java.util.Vector();
    //a Vector of type Dog named dogs composed of Dog ?
    //why underlined in red?

    java.util.Vector cats = new java.util.Vector();
    //same as dogs

    java.util.Vector pets = dogs;
    //a Vector of type...anything which extends Mammal?
    //the Vector referenced by pets?
    //composed of Vector dogs?
    //there aren't any Cat objects in this, yes?

    System.out.println("..DriverCatDog main..done.");
    }//main

    }//DriverCatDog



    Thufir Hawat
    for java code

  3. Re: generics; cannot find symbol; using wildcard

    sorry, wrong ng.

+ Reply to Thread