0
For class we can create object. But for interface whether we can create object are not???
5 Réponses
0
You can not create objects from interfaces. But you can implement interface in class and then create object of this class. Like that:
interface Foo {
...
}
class Bar implements Foo {
...
}
Bar bar = new Bar();
0
Whether We cant create object directly for interface???
0
No, you can't. Interface is an abstraction. You can do like that:
Foo bar = new Bar();
but bar still will be object of Bar class.
0
🙌
0
Super dude