| |
|
What is an interface? How to implement an interface?
An Interface is a collection of semantically related abstract members. An
interface expresses through the members it defines, the behaviors that a class
needs to support. An interface is defined using the keyword interface. The members
defined in an interface contain only definition, no implementation. The members of
an interface are all public by default, any other access specifier cannot be used.
An interface is implemented using implements keyword. A class may implement
more than one keyword.
When a class inherits and implements at the same time, the inherited parent class
name is written first, followed by the names of the interfaces to be implemented.
Click here to know more on Interfaces
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
| |