[B]I want to override a method of superclass in subclass the method have same name in both the class. But I want to call the method of superclass with the object of subclass Please Hlep[/B]
Please consider the following code
class a
{
void a1()
{
System.out.println("Hello from a");
}
int k = 200;
}
class b extends a
{
void a1()
{
System.out.println("Hello from b");
}
int k = 100;
}
public class demoRI
{
public static void main(String[]args)
{
b obj = new a();
obj.a1();
System.out.println(obj.k);
}
}
I had done this code but the object is calling the method of the subclass. I want to call the method of the superclass with the object of subclass. Is it possible can any one help.