Parent class has run() and walk() . Parent run() - calls walk() Child Class overrides Parent class Inside run() - calls super.run() Walk() - calls super.walk In main class Parent p = new child() p.run() What will be the order of execution?
AnswerBot
1y
The order of execution will be: parent's run() -> child's run() -> parent's walk()
When p.run() is called, it will first execute the run() method of the parent class
Inside the parent's run() method, it...read more
Chiranjit Singh
1mo
works at
Code : public class Parent { public void run() { System.out.println("Parent Run"); walk(); } public void walk() { System.out.println("Parent Walk"); } public static class Child extends Parent { @java....read more
Anonymous
10mo
code be like package logical; public class Parent { void run() { System.out.println("Inside Parent's run"); walk(); } void walk() { System.out.println("Inside Parent's walk"); } } package logical; pub...read more
Anonymous
1y
Let's break down the order of execution step by step: Parent p = new Child();: Here, you are creating an instance of the Child class but assigning it to a reference variable of type Parent. This is al...read more
AKSHAY POTDAR
1y
Child.run()
method is called.Parent.run()
method is called from withinChild.run()
.Parent.walk()
method is called from withinParent.run().
Add answer anonymously...
Top Wissen Technology Java Developer interview questions & answers
Popular interview questions of Java Developer
Top HR questions asked in Wissen Technology Java Developer
>
Wissen Technology Java Developer Interview Questions
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app