Topics
you should review to understand this type of questions:
1- Order of assignment of instance variables in the class hierarchy.
2- Polymorphic call of methods.
When you create child object in the main method, as child class constructor
automatically calls the parent class constructor and in this child class
"method()" is called (because object is created of Child class) and by this
time, the instance variable "s" of the child has not been initialized hence
you got the default value of the String as "null".
Note: In future, please place your code inside the [code] tag. It makes the
code readable.
Thanks,
[ May 28, 2007: Message edited by: Chandra Bhatt ]