jimfog Posted October 11, 2012 Share Posted October 11, 2012 What exactly happens when a class implements an interface? I am a little confused with this. Link to comment Share on other sites More sharing options...
birbal Posted October 11, 2012 Share Posted October 11, 2012 interface contains methods without body. if any class implements a interface it must define the body. interface gives consistency between classes who uses them. oppose to multiple inheritance language like c++, java is single inheritance language. here in java interface gives classes to use and share multiple behavior among different classes. Link to comment Share on other sites More sharing options...
Ingolme Posted October 12, 2012 Share Posted October 12, 2012 An interface allows multiple independent classes to be used in the same way. The interface tells the class the name of the methods it has to implement, but each class can implement the methods however suits it best. Link to comment Share on other sites More sharing options...
thescientist Posted October 23, 2012 Share Posted October 23, 2012 (edited) http://docs.oracle.c.../interface.html since classes define the state and behavior of objects (like a blueprint), think of an interface as a class that is the blueprint for another class. Edited October 23, 2012 by thescientist Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now