• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

confusion in k&b page 118  RSS feed

 
Ranch Hand
Posts: 216
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey rancher i have a confusion in the following paragraph that i have took from k&b of page 118 as

" You can extends only one class , but implements many interface. But remember that subclassing define who and what you are , whereas implementing define a role you can play or a hat you can wear, despite how diffrent you might be from some other class implementing the same interface"

in the above paragraph i confused from "But remember that to onwards....

please specify


with regard

Arun kumar maalik
 
Ranch Hand
Posts: 2023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A class that implements the interface agrees to implement all the methods defined in the interface, thereby agreeing to certain behavior. So, we can have different implementation of the same method (that is in interface) in different classes. The coding behavior with interfaces provides a cleaner separation of behavior and implementation.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!