Interface Inheritance (Java Program): meaning of each line of the program?
Hi guys. I'm just preparing for my exam. help me to explain every line of this program:
Code :
interface J {
int j = 200;
int j1();
}
interface K {
double k1();
}
interface L extends J,K{
boolean l1();
}
class I implements L{
public boolean l1() {
return true;
}
public int j1() {
return 4;
}
public double k1() {
return 6.8;
}
}
class InterfaceInheritance{
public static void main(String[] g){
I i=new I();
System.out.println(i.j);
System.out.println(i.j1());
System.out.println(i.k1());
System.out.println(i.l1());
}
}
Result :
200
4
6.8
true
And My second question is how to create o class that implements the interface j and k. Then, call the method on a main program in class InterfaceInheritance.
thanks for helping me prepare for the exam
Re: Interface Inheritance (Java Program): meaning of each line of the program?
You will learn a lot more if you sit down and study the code, research what you don't understand. Asking someone else to explain this code is a vague request - what don't you understand about it? If you have a specific question, ask it.
This thread has been cross posted here:
http://www.java-forums.org/new-java/61255-interface-inheritance-create-class-implements-interface.html
Although cross posting is allowed,
for everyone's benefit, please read:
Java Programming Forums Cross Posting Rules
The Problems With Cross Posting