Posted on 2011-04-25
Last Modified: 2012-05-11

Interfaces allow the construction of nonhierarchical type frameworks.I have not clearly understood this statement, concept.
Please advise. Any ideas, sugestions, sample code, links, resources highly appreciated. thanks in advance
Question by:gudii9
    LVL 47

    Expert Comment

    I once wrote a lot about interfaces in response to one of the EE questions, you may
    read it here:
    LVL 47

    Assisted Solution

    Interfaces allow the construction of nonhierarchical type frameworks -
    this statement emphasizes that if inheritance in Java implies
    strictly hierarchical structure because a class can inherit only
    from one class, interfaces allow to attribute to a Java class
    proprties of a wide range of types - a class can implement
    as many interfaces as you like, which creates a network of connections between
    types/classes which does not need to be hierarchical
    LVL 92

    Assisted Solution

    LVL 26

    Accepted Solution

    A hierarchy is when class A extends B extends C.  A is derived from B which is derived from C.  It's a chain where each class has a single parent.  This means it's a hierarchy and is how Java does inheritance.

    With interfaces, you're allowed to implement multiple interfaces at once.  So we can have:
    class A implements I,J,K
    class B implements I,J,K

    both A and B implement the same classes, but they're not related to each other at all.  They don't have any of the same parent classes, so they're not part of a hierarchy.  It might look like they are derived from I,J,K - but they're implementing the interfaces, not deriving from classes.


    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
    Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
    Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
    This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now