-
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.
Similar Threads
-
By phatslug311 in forum Java
Replies: 7
Last Post: 02-11-2009, 03:02 PM
-
By just a beginner in forum Java
Replies: 2
Last Post: 10-08-2001, 08:13 AM
-
Replies: 3
Last Post: 06-14-2000, 07:08 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
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
|
Bookmarks