Inheritence problem

Can anyone tell me the answer for the problem given below?

class A

{

}

class Bextends A

{

publicstaticvoid main(string arg[])

{

A a =new B();

}

Wat is this A a = new B(); means?

[609 byte] By [ttrra] at [2007-10-3 10:30:57]
# 1
It creates an instance of B and the variable a references that instance.Kaj
kajbja at 2007-7-15 5:53:41 > top of Java-index,Java Essentials,Java Programming...
# 2
Can i access the things present in B?
ttrra at 2007-7-15 5:53:41 > top of Java-index,Java Essentials,Java Programming...
# 3
yes!
angeles1016a at 2007-7-15 5:53:41 > top of Java-index,Java Essentials,Java Programming...
# 4
> Can i access the things present in B?only if a) those things are also present in 'A'orb) you cast the instance to 'B'treating the 'B' instance as an 'A' is polymorphism in action
georgemca at 2007-7-15 5:53:41 > top of Java-index,Java Essentials,Java Programming...