Calling constructor of interface? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 8

Calling constructor of interface?

Below is the code, I need to know why the code don't give error on line 7 when we are calling an interface's constructor in the constructor of a class which is implementing that interface. https://code.sololearn.com/ce4ek30IQm90/?ref=app

20th Jan 2019, 10:52 AM
blACk sh4d0w
blACk sh4d0w - avatar
5 Answers
20th Jan 2019, 11:20 AM
voidneo
+ 7
Can you explain what does line 7 exactly doing?
20th Jan 2019, 11:18 AM
blACk sh4d0w
blACk sh4d0w - avatar
+ 7
neo.h thnx now I understood it.
20th Jan 2019, 11:25 AM
blACk sh4d0w
blACk sh4d0w - avatar
+ 6
neo.h I couldn't understand what do you mean by Object class's constructor? Can you elaborate more?
20th Jan 2019, 11:16 AM
blACk sh4d0w
blACk sh4d0w - avatar
+ 1
You're not actually calling the interface's constructor. See, all classes in java inherit from the Object class, so you're calling the Object class' constructor
20th Jan 2019, 11:10 AM
voidneo