this is a simple java query
someone asked me this
now i dont have an explanation the example is frm bruce eckel's thinking in
java
//****************************************
 import Tools.essential.*;
 class Cat{
        private int Catno;
        Cat(int i){
                Catno = i;
        }
        void print(){
                System.out.println("Cat  " + Catno);
        }
}

class Dog{
        private int Dogno;
        Dog(int i){
                Dogno = i;
                }
        void print(){
                System.out.println("Dog  " + Dogno);
        }
}

public class CatsAndDogs{
        public static void main(String args[]){
                Vector cats = new Vector();
                for(int i=0;i<7;i++){
                        cats.addElement(new Cat(i));
                }
                cats.addElement(new Dog(7));
                for(int j=0;j<cats.size();j++){
                        ((Cat)cats.elementAt(j)).print();
                }
        }
}
//**************************************************************************
can anyone explanin the following line in the code

((Cat)cats.elementAt(j)).print();

thanx
regards
Sam

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to