How to call parent overridden method. Because when I call same method, overridden method of child class is called. But what if i want to call parent method explicitly through object, how can i do it? I want "hello B" as output.
class B
{
B()
{
System.out.println("B");
}
void display()
{
System.out.println("hello B");
}
}
class A extends B
{
A()
{
System.out.println("A");
}
void display()
{
System.out.println("hello A");
}
public static void main(String[] args)
{
A a= new A();
a.display();
}
}
output:
B
A
hello A
expected:
B
A
hello B