I made an interface as:
interface Castle
{
public void sad();
public void cool();
}
Then i made a child abstract class of it as:
abstract class Castle2 implements Castle
{
abstract void sad();
}
Here I left the implementation of cool(), and if i complile the above code, it compiled Successfully But when i added 1 more sub class of Castle2 as:
class Castle3 extends Castle2{
public void sad(){
System.out.println("SAD");
}
public static void main(String...args){
new Castle3().sad();
}
}
And tried to compile the above code then it is not even compiling my code stating the following error
Castle.java:13: error: Castle3 is not abstract and does not override abstract method cool() in Castle
When i run javap tool on class Castle2, then i got the following result
abstract class Castle2 implements Castle {
Castle2();
public void sad();
}
Why Compiler is Forcing me to implement a interface Castle's method in class Castle3 which is not even present in class Castle2? And Why Compiler is not Forcing me to implement a interface Castle's method in class Castle2?