An interface contains only abstract methods.
we cannot create object to interface.
for this we create separate classes where we can implement all the methods of interface.
All members of interface are public and abstract by default.
we cannot use IIB,SIB Constructor inside the interface.
for implementation of interface we use "implements" keyword.
Example:-
Example :-
we create 1 method inside interface and implement it in class Z.
Example 2:- implements method with argument
Example:-Multiple Inheritance using Interface...
bu using interface we can go for multiple inheritance....
Example ;-you can also do like this..
we use interface to achieve full abstractness.inside abstract class at least one method should be abstract and it also contain implemented method but in case of interface we cannot insert any implemented method under interface.
we cannot create object to interface.
for this we create separate classes where we can implement all the methods of interface.
All members of interface are public and abstract by default.
we cannot use IIB,SIB Constructor inside the interface.
for implementation of interface we use "implements" keyword.
Example:-
Example :-
we create 1 method inside interface and implement it in class Z.
Example 2:- implements method with argument
Example:-Multiple Inheritance using Interface...
bu using interface we can go for multiple inheritance....
Example ;-you can also do like this..
we use interface to achieve full abstractness.inside abstract class at least one method should be abstract and it also contain implemented method but in case of interface we cannot insert any implemented method under interface.
No comments :
Post a Comment