The same interface can be implemented by more than one classes as shown below:
class ClassOne implements Interface1
{
//Body of ClassOne
}
class ClassTwo implements Interface1
{
//Body of ClassTwo
}
Lets implement this on Eclipse IDE:
1. Create Interface 'Interface1' under any project as shown below:
7. Observe that the output is displayed in the console as shown below:
Click here to download the project containing the 'Interface1', 'ClassOne', 'ClassTwo', 'ClassThree' and 'MultipleClassesSingleInterface' files used in this post (You can download this project and import into Eclipse IDE on your machine)
Please comment below to feedback or ask questions.
No comments:
Post a Comment