This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
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 OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA 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