Consider the following code:
public class interface Forefather
{
public int i = 5;
static float = 2.3f;
final int k = 3;
}
public class Father
{
}
public class Son extends Father implements Forefather
{
public static void main(
String args[])
{
Forefather ff = new Forefather();
Father f = new Father();
Son s = new Son();
ff = s;
System.out.println("" +ff);
f = s;
System.out.println("f " +f);
}
}
As we know that "if we assign 'existing object reference' to a 'reference variable' both 'reference variables' refer to 'same object'.Also it is legal to assign a 'child object' to a 'parent object'but 'not viceversa'
Further we can also assign an 'object reference' to an 'interface reference' variable if the 'object' implements the 'interface'
so if above is true why cant the above program doesnt compile and run?