This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I have the following scenario (please bear with me on the setup, here)...
Class named "House" has a public static variable named "address". House is a subclass of Building. Building has no variables named "address".
I want to be able to access House.address from Building. Is Reflection my only option? E.g., Building bldg = new House(); I can't say bldg.address to get the House.address variable. Could use reflection, but is there another way that I'm missing?
Goal is to keep Building generic so I can retrieve the "address" of ANY subclass that extends Building.