Why interfaces can't be instantiated in java? Why it is not possible to create objects for an interface?
Because java documentation says so.
Because interfaces will not have implementations, so there is no point of creating objects.
Its wrong, we can instantiate interfaces just like classes.
some times you can instantiate and some times you can't. It depends on what you have in that interface.
We know that interfaces will not have any method bodies and variables. When we create an object, obviously we will start calling some methods or use variables on that object. But if there are no method bodies, java will give linking error while calling that function. So there is no point in creating objects for an interface as it doesn't have method bodies and variables.
Back To Top