I have three interfaces as follows.
interface CFL extends PowerSaver, LightingDevice{
void showLifeTime();
void getBrand();
}
interface PowerSaver {
void showEcoRate();
}
interface LightingDevice {
void doLight();
}
Then I create a abstract class called Philips that implements CFL
public abstract class Philips implements CFL{
void showLifeTime(){}; // Compiler says Cannot reduce the visibility of the inherited method from CFL.
void showEcoRate(){}; // Compiler says Cannot reduce the visibility of the inherited method from CFL.
}
My question is why it says that I Cannot reduce the visibility of the inherited method from CFL. while I haven’t reduced it?
Interface implementations must be
public.To understand the error, see the spec:
Therefore, you’re actually overriding (or, in this case, implementing)
publicmethods.