How do i implement this interface

G

gk

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 ?
 
D

Daniel Dyer

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,763
Messages
2,569,563
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top