0

Why last output is printed?

Why Here man class is empty but it is calling parents class member? Anyone please tell me the reason ? https://code.sololearn.com/c7wxer3dYRFq/?ref=app

20th Mar 2021, 2:30 PM
Samarendra Singh
Samarendra Singh - avatar
3 Respostas
+ 5
On!oN In Java there is default constructor. So no need to define it. There is other types of constructor also like parameterized and copy constructor. For parameterized constructor, you have to explicitly define it. Also constructor is used to initialise objects, set default data. Constructor is not used to call method. To call method you have to create object of class.
20th Mar 2021, 4:55 PM
A͢J
A͢J - avatar
0
Yeah , but there's no any construction then how any method called?
20th Mar 2021, 2:46 PM
Samarendra Singh
Samarendra Singh - avatar
0
「HAPPY TO HELP」 i mean, in parent class there's no constructor then how can method is called? And by inheritance it inherited the behaviour of parent class but just making an object , how method is called?
20th Mar 2021, 3:08 PM
Samarendra Singh
Samarendra Singh - avatar