0

For class we can create object. But for interface whether we can create object are not???

28th Apr 2017, 4:21 PM
tharun
tharun - avatar
5 Answers
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();
28th Apr 2017, 4:26 PM
Jeth
Jeth - avatar
0
Whether We cant create object directly for interface???
28th Apr 2017, 4:27 PM
tharun
tharun - avatar
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.
28th Apr 2017, 4:28 PM
Jeth
Jeth - avatar
0
🙌
28th Apr 2017, 4:30 PM
tharun
tharun - avatar
0
Super dude
28th Apr 2017, 4:30 PM
tharun
tharun - avatar