Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

abstract class and interface

 
gunjan khanuja
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
should an abstract class implementing an interface define all the methods of the interface??


Can a class implementing an interface overload the methods of the interface??
 
gurpeet singh
Ranch Hand
Posts: 924
1
Fedora Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi gunjan. An abstract method need not implement all or any methods of the interface . it can choose to implement all, some or none of the methods in the interface. and answer to your second question according to me is YES . you can overload the methods of the interface you are implementing in your class.
 
saloni jhanwar
Ranch Hand
Posts: 583
Firefox Browser Notepad Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
gunjan khanuja wrote:should an abstract class implementing an interface define all the methods of the interface??


It is not necessary to define interface methods in abstract class, however you can also do this there ,but if you don't do so then you have to define all undefined interface methods in first concrete class.(first subclass of abstract class)

gunjan khanuja wrote:Can a class implementing an interface overload the methods of the interface??


Yes, you can overload interface methods.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic