Results 1 to 3 of 3
  1. #1
    sreekanthgude is offline Member
    Join Date
    Jan 2014
    Posts
    3
    Rep Power
    0

    Post Interface Overview

    please refer below link for neat explanation

    Interface Overview? « Programmers99

    Hi Guys i am going to share Interface concept overview in Java, so let's go :-)


    ---> Normally interface considered as a Service Requirement Specification(SRS).
    ---> In real time the client point of view an interface is the set of services what they are Expecting

    Ex: ATM


    ---> From the service provider point of view an interface defines the set of services what they are
    offering.

    ---> Finally we call interface is contract between client and service provider


    For clear understanding purpose i will explain with one good example.


    ----> By using bank ATM GUI screen, bank people will highlate the set of services

    what they are offering at the same time screen describes the set of services what end user is expected

    hence this GUI screen act as contract between bank people and customer.


    ----> With in interface we can't provide any implementation because it has to highlate just the

    set of services what we are offering or what you are expecting . hence every method present

    inside interface should be abstract. Due to this interface is considered as 100% pure abstract class.


    ----> The main advantages of Interfaces are:

    1) Two different systems can communicate via interface

    Ex: A java application can talk with mainframe system through interface.

    2) We can achieve security.Because we are not highlighting our internal implementation

    3) Enhancement will become very easy. because without effecting outside person we can

    change our internal implementation.


    Now the concept is How to declare and implement the interface:


    ----> We can declare interface by using interface keyword, we can implement an interface by using

    implements keyword.


    Ex:- Declaration

    interface Inter

    {

    void m1();
    // abstract methods
    void m2();

    }

    By default in interface abstract methods are public abstract

    Ex:- Implementation


    class A implements Inter

    {

    public void m1(){
    //our implementation
    }
    public void m2(){
    //our implementation
    }
    }


    Note:- We need to provide implementation to every abstract method in interface. otherwise we will

    get compile time error. if we want provides implementation to some methods we need to make class as abstract.


    ----> when ever we are implementing an interface method compulsary it should be declare as public otherwise we will get compiletime error.

    That's it Guys still u have any doubts on interface concept please put a comment below.

    i will try to clarify those... Have a nice day... :-)

  2. #2
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    United States
    Posts
    3,382
    Rep Power
    5

    Default Re: Interface Overview

    Do you have a question? Why did you post this? And why did you post a link to a site and then simply copy the contents after the post?

    Regards,
    Jim
    The Java Tutorial | SSCCE | Java Naming Conventions
    Poor planning our your part does not constitute an emergency on my part.

  3. #3
    SurfMan's Avatar
    SurfMan is online now Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    916
    Rep Power
    2

    Default Re: Interface Overview

    And if you really want to tell something about interfaces, don't use (or copy) names like Inter, m1(), m2(). Make it a real world example. This piece of text will only confuse beginners even more.
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2 2013

Similar Threads

  1. Replies: 1
    Last Post: 07-08-2012, 05:23 PM
  2. Need help drawing an overview
    By czepluch in forum AWT / Swing
    Replies: 3
    Last Post: 11-30-2011, 07:31 PM
  3. Maven Dependency Overview 1.1
    By Java Tip in forum Java Software
    Replies: 0
    Last Post: 07-02-2008, 07:13 PM
  4. Maven Dependency Overview 1.0
    By Java Tip in forum Java Software
    Replies: 0
    Last Post: 04-15-2008, 06:52 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •