Re: understand the concept of interfaces



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

It is not a workaround,
the way Java implements inheritance / interfaces
has the side effect of
eliminating the classic multiple-inheritance issue.

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..

An interface is a promise to implement a method with a specific name and a specific signature.

The beauty when it comes to the classic multiple-inheritance issue is;
two different interfaces used for different purposes
could potentially have a name/signature conflict,
in which case sorting out the mess
is left as an exercise for the person implementing the class.

As Java only allows you to extend one class
there can never be two conflicting implementations.
.



Relevant Pages

  • Re: interfaces
    ... Java doesnt support Multiple Inheritance instead the work around is to use ... .if interface is just emply methods then what is ... The beauty when it comes to the classic multiple-inheritance issue is; ...
    (comp.lang.java.help)
  • understand the concept of interfaces
    ... 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 ... but the doubt i have is interface are nothing but empty abstract ...
    (comp.lang.java.help)
  • interfaces
    ... 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 ... but the doubt i have is interface are nothing but empty abstract ...
    (comp.lang.java.help)
  • Re: Darkroom software Help
    ... Apple's computer operating system OS-X includes the Java ... programing language, compiler, and integration software. ... have an Apple this fall. ... Said that, my system is based on a commercial lab interface, the ...
    (rec.photo.darkroom)
  • Re: A C++ Whishlist
    ... with the C++ string classes as compared with the Java ones. ... You can keep you structs entirely ... The simple separation of interface and implementation that header files ...
    (comp.lang.cpp)