Re: understand the concept of interfaces
- From: "Francis" <francislukose@xxxxxxxxx>
- Date: 28 Nov 2006 00:54:23 -0800
Prejith,
Try to imagine a computer's keyboard which contains the logic that
executes when a key pressed.
In this scenario, we need separate keyboards for each processors
ie, A key board which uses in Pentium processor can't be use with AMD
processors.
To solve this problem we need to extract the processing logic from
Keyboard and let it done in processor.
Then there is a problem arouse that the processor vendor may will
develop different implementation and functions for keyboards for their
processor. So we need to give a commor rule for developing keyboad
logics for the processor vendors in the following way:
public interface KeyBoard {
void a();
void b();
......
......
}
public class AMDProcessor implements KeyBoard {
public void a() {
.........
}
..............
}
public class PentiumProcessor implements KeyBoard {
public void a() {
.........
}
..............
}
Interfaces are not another way to implement multiple inheritance.
I think this explanation may help u to understand interfaces.
Francis
Prejith wrote:
i am new to java and i am in the learning phase of core java .i know that
Java doesnt support Multiple Inheritance instead the work around is to use
Interface
but the doubt i have is interface are nothing but empty abstract
methods.when ever i implement those methods in a class i have to write the
method body in the class.. .if interface is just emply methods then what is
the point of having those empty method names under one tag..
i dont know whether my understanding about interface is correct.if not
please correct me and also if possible give me an explanation...
regards
Prejith
.
- References:
- understand the concept of interfaces
- From: Prejith
- understand the concept of interfaces
- Prev by Date: understand the concept of interfaces
- Next by Date: Re: understand the concept of interfaces
- Previous by thread: understand the concept of interfaces
- Next by thread: Re: understand the concept of interfaces
- Index(es):
Relevant Pages
|
|