Results 1 to 4 of 4

Thread: Interface

  1. #1
    Anandiscool is offline Member
    Join Date
    Mar 2010
    Posts
    4
    Rep Power
    0

    Default Interface

    Hi,
    interface A
    {
    void show();
    }
    class B implements A
    {
    public void show()
    {}
    }
    In this code, Why we write "public"?
    :cool:

  2. #2
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,778
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by Anandiscool View Post
    In this code, Why we write "public"?
    Methods declared in an interface are always public by definition so an implementation thereof also has to be public because you can't reduce their visibility.

    kind regards,

    Jos

  3. #3
    Anandiscool is offline Member
    Join Date
    Mar 2010
    Posts
    4
    Rep Power
    0

    Default

    Thanks alot.
    Is there any site to download the Java Books?

  4. #4
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,778
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by Anandiscool View Post
    Thanks alot.
    Is there any site to download the Java Books?
    It's all here.

    kind regards,

    Jos

Similar Threads

  1. Regarding interface
    By hedonist in forum Advanced Java
    Replies: 4
    Last Post: 10-13-2009, 04:57 PM
  2. what is the need of interface?
    By makpandian in forum New To Java
    Replies: 1
    Last Post: 03-13-2009, 11:59 AM

Posting Permissions

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