• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

what goes wrong - interface doubt

 
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

why this is not compiling?


[HENRY: Added code tags]
[ October 27, 2006: Message edited by: Henry Wong ]
 
Ranch Hand
Posts: 392
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


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
Posts: 135
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for your clarifications.
 
reply
    Bookmark Topic Watch Topic
  • New Topic