class Dad
{
protected static String me = \"dad\";
public void printMe()
{
System.out.println(me);
}
}
class Son extends Dad
{
protected
Yes. But as the variable is concerned it is overwrite (Giving new value to variable. Giving new definition to the function is Override).Just don't declare the variable but initialize (change) in the constructor or static block.
The value will get reflected when using in the blocks of parent class
if the variable is static then change the value during initialization itself with static block,
class Son extends Dad {
static {
me = 'son';
}
}
or else change in constructor.
You can also change the value later in any blocks. It will get reflected in super class