Keith is exactly right, but I don't know if he answered your question.
The output will be:
2
3
Polymorphism works for (properly overridden) methods, but not for instance variables. In theory,
Java (or C++) could (with a bit of work) support polymorphism for instance variables. But they don't. And there aren't any serious reasons that they should. If you want an instance variable to behave polymorphically, you can change the variable to a "variable-like" method. For example, the following "variable-like" method can be overridden:
int x() { return 3; }
[ July 11, 2006: Message edited by: Douglas Chorpita ]