upcasting and downcasting
843785Nov 19 2008 — edited Nov 19 2008hi
can any one tell me
1)what is upcasting and downcasting?
2)class SuperClass{
public void show(){System.out.println("super");}
}
class SubClass extends SuperClass{
public void show(){System.out.println("sub");
}
public void m1(){
System.out.println("m1()");
}
public static void main(String s[]){
SuperClass s1=new SubClass();
s1.show();// output---- sub
s1.m1();// it will give error
}
}
can any one tell me how can i call sub class m1() using s1 reference.
thansk in advance