Can you define a constructor in an interface?
I'll answer
Earn 20 gold coins for an accepted answer.20
Earn 20 gold coins for an accepted answer.
40more
40more
Works at Google, Lives in Mountain View, CA
There is only static fields in interface that dosen't need to initialized during object creation in subclass and the method of interface has to provide actual implementation in subclass .So there is no need of constructor in interface. ... That's why we can not define constructor in the interfaces.May 10, 2010
2023-06-10 06:42:34
评论(499)
Helpful(122)
Helpful
Helpful(2)

Amelia Kim
QuesHub.com delivers expert answers and knowledge to you.
There is only static fields in interface that dosen't need to initialized during object creation in subclass and the method of interface has to provide actual implementation in subclass .So there is no need of constructor in interface. ... That's why we can not define constructor in the interfaces.May 10, 2010