I know the line
c instance of A ------------- is incorrect
Since class C do not extend A .
When i compile the code i get the error that they are inconvertible types which is fine.
But same code when i run means---------- java MyInstance --------- it gives me the desired output
Which should not be obtained.
You can try:
First compile the code we get an error
In spite of the error run the code output is obtained.
I am not able to understand how come the code runs fine in spirte of compile error.