Re: understand the concept of interfaces



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

.



Relevant Pages

  • Re: C= at the CES Show in Vegas
    ... Some details on the interface: ... It will interface a CBM keyboard to a PS/2 compatible PC ... Positional mappings use VICE mappings, ...
    (comp.sys.cbm)
  • Re: Oric Drives
    ... > Thierry Bestel indeed demonstrated his PC keyboard interface at a CEO ... ie. the pulses get fed onto the joystick pins ...
    (comp.sys.oric)
  • Re: Looking for basic bank switch/control change software
    ... you use the PC keyboard as a "piano" keyboard. ... Edirol MIDI interface in response to hot keys. ... I went back and took a closer look at MidiOx help. ...
    (comp.music.midi)
  • Re: Looking for basic bank switch/control change software
    ... you use the PC keyboard as a "piano" keyboard. ... Edirol MIDI interface in response to hot keys. ... I went back and took a closer look at MidiOx help. ...
    (comp.music.midi)
  • Re: HeathField Strange Ideas!
    ... interface that can be included in a program so to interface with the ... these keyboard events; X is an official standard, ... by quite a number of systems, and MS Windows is a de-facto standard, ... What the C standard deals with is *character streams* (or byte ...
    (comp.lang.c)