Interfaces are always abstract, but they're not necessarily public. You may have heard that the members of an interface (the fields, methods, and nested classes (or interfaces) declared directly inside the interface) are always public. That's true.* But that's not the same as saying that the interface itself is public.
* Note I said, declared directly inside an interface. You could have a nested class inside an interface, and that class could declare a private field - but that field would not be directly inside the interface, and it would not be a member of the interface. In case you were wondering... [ February 22, 2005: Message edited by: Jim Yingst ]
"I'm not back." - Bill Harding, Twister
Joined: Mar 27, 2004
Interesting. I thought I read in K & B's book that interfaces are always public (I'm pretty sure about that, at least in the portugues version of the book). So they can have default access too, unh. Thanks Jim.
That`s not exactly the point. As I said, i thought i had seen in Kathy`s book (and i actually comfirmed it in the portuguese version of the book) that interfaces are always public. So even if i didn`t insert the public keyword before interfaces it would be a public one, but this is not true.
hai i tried to put the interface inside a inner class but it give a compile error.
I am confused.
As Jim said an interface inside a class is abstract by default. But when i tried to put the interface inside a inner class i get a compile error saying that " static declaration inside an non-static inner class".
So according to this compile error,the interface inside an inner class is static by default.
So is it like this,only static inner class can have interface as its member....???
So is it like this,only static inner class can have interface as its member?
Actually, only an outer class, a static inner class, or an inner interface can have an interface as its member.
Joined: Mar 13, 2004
As I said, I thought I had seen in Kathy`s book (and I actually comfirmed it in the Portuguese version of the book) that interfaces are always public.
K&B page 115 says: "The public modifier is required if you want the interface to have public rather than default access."
Perhaps you were confused by this line: "All interface methods are implicitly public and abstract."
Joined: Mar 27, 2004
Hi Mike. Now I understand that, but I have the portuguese version of the book. I carefully took a look at it and it says: "Interfaces s�o sempre publicas e abstratas ..." Translating to english it means that interfaces are always public and abstract. This for sure a translation error from the original version, just like some other ones that I`ve seen. It`s said, but the portuguese version of the book has quite a large number of errors for this kind of book.
Joined: Jan 24, 2005
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com