/* ============================================================ Demo using interface variable ============================================================ */ public class Demo { public static void main(String[] args) { myInterface a; // This is an UPCASTING operation: myInterface is a parent class ! a = new myClass(); // Upcasting ! a.myMethod(); // Polymorphism ! // This shows you that an interface is a superclass !!! a = new myClass2(); // Upcasting ! a.myMethod(); // Polymorphism ! } }