• 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

Interface Concept in anonymous classes///

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




/// My doubt is " as per interface concept we must and should implement all the methods present in interface should implement by the class. In one rare case there are "N"- no of methods in interface but i want to implement only some of them.... can we do this without implementing other methods of interface?
 
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to Javaranch

Please use CODE tag while posting your code,so that it can be readable.

Linga wrote:
In one rare case there are "N"- no of methods in interface but i want to implement only some of them.... can we do this without implementing other methods of interface?



1.Create one AbstractInterface and provide some default implementation[or throw UnsupportedOperationException] for those methods which are not going to use in a Concrete class(Let say X) . and X extends AbstractInterface instead of Interface

2. or Implements all the mothod and throw an UnsupportedOperationException from the methods which are not neccessary
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic