Hi
code below is giving me error :
java.lang.ClassCastException
at Example.main(Example.java:28)
Exception in
thread "main"
class Abs
{
void m()
{
System.out.println("hellooo11111111");
}
}
public class Example extends Abs {
public static void main(
String args[])
{
Example a = new Example();
Abs abs = new Abs();
Example a1 = (Example) abs; // why is this giving error?
a1.m(); //can't we cast like this.
}
void m()
{
System.out.println("hellooo");
}
}