Extends and implements
I've just learned Java and i have a problem. That is extends and imlements.
Can you tell me when use extends and imlements in heritage class.
And tell me the different of them.
Thank you !
You implement an interface. An interface is the "signature" (declaration) of fields or methods which will be defined in those classes which implement the interface. It allows a calling class to address all objects which implement the interface in a common way, while each implementation can carry out the work differently.
You extend a parent class (inheritance). You inherit the parent class's fields and methods, which you can supplement or override.
actually interfaces (those are implemented) exist because java doesn't support the multiple inheritance - you can think of a lot of reasons when it comes methods which have the same signature. Interfaces offer a lot other advantages. a class can implement many interfaces. because the methods are never implemented - only their signature exists... read more about it on the net... wikipedia should give you an overview about the basic principles of java.
By phatslug311 in forum Java
Last Post: 02-11-2009, 04:02 PM
By just a beginner in forum Java
Last Post: 10-08-2001, 09:13 AM
Last Post: 06-14-2000, 08:08 PM
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL