Prepare for your Next Interview
This is a discussion on which one more powerful in java ? within the Java forums, part of the Software Development category; Which concept (Interface or Inheritance) is more powerful in java? ------------- suresh...
|
|||
|
Re: which one more powerful in java ?
hi
I think both are equally imp in java!Still i think may be inheritance simply coz it allows code reusability.interfaces used for multiple inheriance only,so i think inheritance is powerful. bye ![]()
__________________
:) NEVER SAY DIE. |
|
|||
|
Re: which one more powerful in java ?
Inheritence is a time tested, 'globally' accepted feature. So inheritence is a very, very powerfule feature.
Interfaces are powerful only because inheritence is powerful. Interfaces combine two very important notions in programming. Inheritence + abstraction = interface The abstractness part allows us to 'program to interfaces' and is used in atleast a couple of design patterns (I know only two p[atterns ). This provides a common interface making the code extensible and maintanable at the same time.And you know what inheritence brings to the package. I still can't decide which is more powerful ![]() |
|
|||
|
Re: which one more powerful in java ?
Inheritance -->enforces reusability in the design phase (closed to traffic at runtime JRE ).
Interface --> enforces and defines an open standard for any future framework to be build upon. (open to traffic at runtime JRE ) |
|
|||
|
Re: which one more powerful in java ?
As the famous GoF book says:
Prefer interfaces over inheritance. Use interfaces as a design-time resource when you are planning your system. Inheritance should be used almos always to reuse code. If your system is designed based on interfaces, it will be easier to maintain and to evolve. Of course this is not a fixed rule, but it works most of the time. -------------- Neelima |
|
|||
|
Re: which one more powerful in java ?
Interface. Because Multiple inheritance are not allowed in jave
|
|
|||
|
Re: which one more powerful in java ?
Inheritance is the major force behind any object oriented language.
First inheritance concept comes in picture then any other thing(like interface) which need to be inherited. So powerful in Inheritence offcourse!!! |
| The Following User Says Thank You to navneett For This Useful Post: | ||
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| What are the advantages of .net over Java? | JobHelper | VB.NET | 9 | 3 Weeks Ago 01:40 AM |
| Sockets in Java | janelyn | Java | 3 | 07-26-2008 10:07 AM |
| multiple inheritance in java... | psuresh1982 | Java | 20 | 07-23-2007 02:33 PM |
| Which is Powerful | janelyn | C and C++ | 1 | 08-31-2006 04:37 PM |
| java compatibility with php | rohit_iips | PHP | 0 | 07-30-2006 01:59 AM |