How do i implement this interface

Discussion in 'Java' started by gk, Oct 2, 2006.

  1. gk

    gk Guest

    public interface AQuestion
    {
    public abstract void someMethod() throws Exception;
    }




    http://www.angelfire.com/or/abhilash/Main.html

    see Question no 5.


    How do i implement this interface ?

    (1) problem is, it has an abstract method and hecne its complicated
    to implement this class.

    (2) another problem is, it is the public interface and hence we can not
    make one more public class in the same file....because 1 file can have
    only 1 public access specifier.




    is it really possible to implement this interface ?
    gk, Oct 2, 2006
    #1
    1. Advertising

  2. gk

    Daniel Dyer Guest

    On Mon, 02 Oct 2006 10:19:13 +0100, gk <> wrote:

    > public interface AQuestion
    > {
    > public abstract void someMethod() throws Exception;
    > }
    >
    >
    > How do i implement this interface ?
    >
    > (1) problem is, it has an abstract method and hecne its complicated
    > to implement this class.


    All interface methods are automatically public and abstract, so the
    modifiers are redundant. This interface is exactly the same as:

    public interface AQuestion
    {
    void someMethod() throws Exception;
    }


    > (2) another problem is, it is the public interface and hence we can not
    > make one more public class in the same file....because 1 file can have
    > only 1 public access specifier.


    So put it in another file.

    > is it really possible to implement this interface ?


    Yes.

    Dan.

    --
    Daniel Dyer
    http://www.dandyer.co.uk
    Daniel Dyer, Oct 2, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. frank

    Implement IList Interface

    frank, Jul 11, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    563
    frank
    Jul 11, 2003
  2. Marco Vasquez
    Replies:
    0
    Views:
    379
    Marco Vasquez
    Dec 30, 2003
  3. Martin
    Replies:
    0
    Views:
    1,101
    Martin
    May 19, 2005
  4. beau
    Replies:
    2
    Views:
    316
    E.C. B├Ąck
    Aug 30, 2003
  5. Bruce Sam
    Replies:
    5
    Views:
    7,823
    Mike Schilling
    Jan 13, 2005
Loading...

Share This Page