This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem in understanding -how interface helpful

 
abdul ambalam
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
interface does not have method implementation. only class which implements interface must implememt all the methods defined in interface.
My question is why should we implement interface as we can write our own code. In java, Serializable and Cloneable dont have anything inside. How it is useful in serializing and cloning objects. does compiler have anything to understand these interfaces. I have many question regarding interfaces.
Can anyone answer to all the possible questions reg-interfaces. Thankyou.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34095
337
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Abdul,
The interface is a way of declaring your intent. While Serializable doesn't have any required methods, you are telling the compiler that it is ok to serialize your object.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic