+ 2

In which situations interface will be used?

12th Jul 2016, 6:38 PM
Iskandar Ashurov
Iskandar Ashurov - avatar
5 Answers
+ 2
Interface are commonly used to give some specific role to a class present in som hierarchical Tree. Also, interfaces are also extensively used as Application Programming Interface(API) that encapsulates the business logics service.
12th Jul 2016, 7:47 PM
Mohit Gupta
Mohit Gupta - avatar
+ 1
You may need to use an interface written by someone else when you need to use or override some methods specified in the interface while you're writing your own classes. A real example would be the interfaces in the java collections framework (Collection, Set, List, Map etc) where you'll need their functionality when organising a set of stuff (e.g. sort/add/remove stuff in an array)
12th Jul 2016, 7:53 PM
Triniel
0
supposed you have to extend two or more class, then what will you do? so interface can be used to inherit multiple class. for project purpose.. supposed you want your project members to work on some same methods and you want them to use those methods any how . so we can create an interface class which after inheriting the one who is inheriting that class must have to override the methods inside the interface.
12th Jul 2016, 7:54 PM
Dhiman Das
Dhiman Das - avatar
0
Main purpose of interface is to achieve multiple inheritence.
13th Jul 2016, 3:38 AM
Thirugnanasambandhamurthy Arumugam
0
thanks to all
16th Jul 2016, 5:14 PM
Iskandar Ashurov
Iskandar Ashurov - avatar