Any object in Java is strongly converted to an interface type without compiling errors
Public class Implements eatable{ publicstaticvoid main (String args[]) { = (drinkable) New Apple (); }} Interface eatable{} Interface drinkable{}
Classes in Java can implement interfaces much more, and the Java compiler cannot tell if the class implements the interface so there are no compile errors.
But a class in Java is strongly moved to another class, and if the class is not its parent, the compilation error is reported because the classes in Java are single-inherited and can be judged by the compiler.
Public class extends eatable{ publicstaticvoid main (String args[]) { ( drinkable) New Apple (); Error inconvertible Types:can not cast Apple to drinkable }}class eatable{}class
drinkable{}
About an issue where any object in Java is cast to an interface type