79246335

Date: 2024-12-03 05:19:18
Score: 1.5
Natty:
Report link

answering to why we get Main m1 and A constructor .After inheriting if we execute class Main(i.e. java Main). We get class Main members as instance block {m1();} constructor A() and object of Class Main (i.e. Main m = new Main()) ,method m1()(i.e. overridden and now it's output is (Main m1)).The control flow is from first block { m1();} executed but m1(); is overridden so we get "Main m1"and then constructor A(){} is executed so we get "A constructor".

Reasons:
  • No code block (0.5):
  • Low reputation (1):
Posted by: Rakesh Nayak