File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes what goes wrong - interface doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "what goes wrong - interface doubt" Watch "what goes wrong - interface doubt" New topic
Author

what goes wrong - interface doubt

raja kanak
Ranch Hand

Joined: Oct 18, 2006
Posts: 135

why this is not compiling?


[HENRY: Added code tags]
[ October 27, 2006: Message edited by: Henry Wong ]

live
Sandeep Vaid
Ranch Hand

Joined: Feb 27, 2006
Posts: 390

interface A {
aFunction();
}
interface B extends A {
bFunction();
}
public class ImpleTest implements B{
aFunction(){}
bFunction(){}
}

why this is not compiling?

First of all your methods don't have a return type.
Secondly,
The methods in an interface are by default public abstract. Now when you override a method (in our case public) you can't make it's access type less restrictive(eq from public to default in your case).

Assuming return type void :

raja kanak
Ranch Hand

Joined: Oct 18, 2006
Posts: 135
thanks for your clarifications.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: what goes wrong - interface doubt
 
Similar Threads
Interface Queries : Java
Preprocess JavaScript source code
Create New Driver
JNI problem, pasing String to native (C function) by reference
What does this do? (function($){ ... })(jQuery);