public class Demo { public static void main( String[] args ) { ClassA a = new ClassA(); ClassB b; b = (ClassB) a; // Improper downcasting !!! // Java compiler cannot detect the error // But it will result in runtime error ! } }