class Light{
protected
String billType ="Small bill";
}
class TubeLight extends Light{
public String billType="Large bill";
}
public class Client{
public static void main(String args[])
{
Light lightRef1=tubeLightRef;
System.out.println(lightRef1.billType);
}
}
Output:
Small bill
I expected "Large bill" here in this upcasting as lightRef1 denotes the Tubelight Object.Please explain.