Like classes, interfaces can also be extended. This is done by the keyword extends as follows

Example

interface A extends B
{
     // Body of A
}

Example

interface SilanSoftware
{
int x=10;
string name="Mona";
}
interface SilanTechnology extends SilanSoftware
{
void show( );
}

  • Here the interface SilanTechnology will inherit both the constants x and name. It is pointed that the variable x and name are declared as simple variables. it is allowed because all the variables in an interface are treated as constants although the keyword final or static are not present.
  • According to the concept of interface, it is possible to combine several interfaces together into a single interface. For example

Example

interface A
{
}
int x=10;
string name="Mona";
}
interface B
{
void show( );
}
interface Demo extends A,B
{
- - - -
- - - -
}

Our Services:

Java Training | Python Training | Machine Learning with Python Training | Deep Learning with Python Training | Data Science with Python Training | Projects

SILAN Technology
Call to: 9439202111  |  9658317757  |  0674-2361252

Comment