Page 405 - CITS - Computer Software Application -TT
P. 405
COMPUTER SOFTWARE APPLICATION - CITS
Look at the below figure a, b, c, and d to understand better.
1 We can define all the constants in one interface and methods in another interface. We can use constants in
classes where methods are not required. Look at the example below.
interface A
{
int x = 10;
int y = 20;
}
interface B extends A
{
void show();
}
The interface B would inherit both constants x and y into it.
2 We can also extend various interfaces together by a single interface. The general declaration is given below:
interface A
{
int x = 20;
int y = 30;
}
interface B extends A
{
void show();
}
interface C extends A, B
{
. . . . . . . .
}
392
CITS : IT&ITES - Computer Software Application - Lesson 109 - 115