Can we use constructor in interface ? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 12

Can we use constructor in interface ?

29th Jan 2019, 1:34 AM
Chetan
2 Respostas
+ 20
GenerallyĀ constructorsĀ r for initializing non-static members of particular class with respect to object.......There is no object creation for interfaceĀ as there is only declared methods but not defined methods......... so object creation is not possible for interface......... That's whyĀ we canĀ not define constructorĀ in theĀ interfaces......
29th Jan 2019, 7:32 AM
Kshitija Raut
Kshitija Raut - avatar