| |
4.3.9.If the type of the left operand is an interface I, the type of the right operand must be a subinterface of I, or a class that implements I, or the null value. |
|
public class MainClass{
public static void main(String[] argv){
MyInterface myClass = new MyClass();
}
}
class MyClass{
}
interface MyInterface{
}
class MySubclass extends MyClass implements MyInterface{
}
|
|
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
Type mismatch: cannot convert from MyClass to MyInterface
at MainClass.main(MainClass.java:3) |
|