Software Testing Studio | WhatsApp 91-6232667387’s Post

#Interview-143: Java - Can you create an object of an interface? Why or Why not? No, we cannot directly create an object of an interface in Java. An interface is just a blueprint, not a complete implementation. It only contains method declarations (at least conceptually), and doesn’t provide the full behaviour needed to create an object. We can create a reference of an interface, but the actual object will be of a class that implements that interface. Can we ever “create” an interface object? Indirectly, yes. We can use: Anonymous classes OR Lambda expressions (for functional interfaces). #interviewprep #interview #testing #qajobs #jobs #jobsearch #jobseekers #hiring #hiringnow #lookingforjob #manualtesting #testautomation #bdd #cucumber #testng #etltesting #performance #apitesting #softwaretesting #manualtester #qatester

To view or add a comment, sign in

Explore content categories