I'm trying to figure out why this doesn't accomplish the same thing since B extends A anyhow. Newbie question. Thanks.
B b = new B(); On Dec 23, 2009, at 12:47 PM, shivakant1 choudhary <[email protected] > wrote: > Class A{ > } > ClassB extends A{ > } > Class Main { > public static void main(String s[])[ > A a=new B(); > //Here a is a reference variable > } > > On Wed, Dec 23, 2009 at 8: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] > 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 -- 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
