Hi; Reference Variables are defined in two cases in java; 1. When you define an abstract class; then extend it by its sub classes. You can define variables of abstract class type; but can not create an object of that abstract class; and you should assign it an object of its sub-classes type. It is primarily used for Polymorphism. 2. The same as above; but the super class is not abstract and you can assign any object of its sub-classes; but no polymorphism; it is the principle of Generalization; ;; NOT SURE ABOUT IT, I'LL CHECK IT AS SOON AS POSSIBLE (THE EXAMS PASSED!) ;;
be happy with java & With the hope of rising of Mahdi; Ali Shakiba Iran - Kerman On Wed, Dec 23, 2009 at 6:46 PM, Shashank Malhotra <[email protected]>wrote: > I came across the following line: > A reference variable of a superclass can be assigned a reference to > any subclass derived from that superclass. > what does that mean?? > What is a reference variable?? > > -- > To post to this group, send email to > [email protected] > To unsubscribe from this group, send email to > [email protected]<javaprogrammingwithpassion%[email protected]> > For more options, visit this group at > http://groups.google.com/group/javaprogrammingwithpassion?hl=en -- To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/javaprogrammingwithpassion?hl=en
