Parent class has run() and walk(). Parent run() calls walk(). Child Class overrides Parent class. Inside run(), it calls super.run(). Walk() calls super.walk(). In the 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
7mo
currently not working (unverified)
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
1y
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
thecoolboy
1y
works at
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
2y
    Child.run() method is called.Parent.run() method is called from within Child.run().Parent.walk() method is called from within Parent.run().
Select
Add answer anonymously...

Wissen Technology Java Developer interview questions & answers

A Java Developer was asked 1w agoQ. What are the features introduced in Java 8?
A Java Developer was asked 1w agoQ. What is a functional interface?
A Java Developer was asked 1w agoQ. Given a 2D matrix, how can you perform a spiral traversal to obtain a 1D array?

Popular interview questions of Java Developer

A Java Developer was asked 1w agoQ1. What is a functional interface?
A Java Developer was asked 1w agoQ2. Given a 2D matrix, how can you perform a spiral traversal to obtain a 1D array?
A Java Developer was asked 1w agoQ3. What are the features introduced in Java 8?
Wissen Technology Java Developer Interview Questions
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+

Reviews

10L+

Interviews

4 Cr+

Salaries

1.5 Cr+

Users

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2025 Info Edge (India) Ltd.

Follow Us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter
Profile Image
Hello, Guest
AmbitionBox Employee Choice Awards 2025
Winners announced!
awards-icon
Contribute to help millions!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos
Add office benefits
Add office benefits