| | |
Inheritance
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Dec 2008
Posts: 3
Reputation:
Solved Threads: 0
Hello,
Please tell me in Java we don't have a multiple inheritance? so,in which function we use these inheritance.
Thanks
Please tell me in Java we don't have a multiple inheritance? so,in which function we use these inheritance.
Thanks
•
•
•
•
Hello,
Please tell me in Java we don't have a multiple inheritance? so,in which function we use these inheritance.
Thanks
> we don't have a multiple inheritance
but then you ask:>in which function we use these inheritance
The only thing I can say is that java doesn't have multiple class inheritance, but multiple Interface implementation.
If that doesn't cover you, ask a better question
Check out my New Bike at my Public Profile at the "About Me" tab
That's what javaAddict said, Java does not have multiple class inheritance, you can only only extend (is-A) one class. However you can implement (has-A) any amount of interfaces you want.
Last edited by jasimp; Dec 31st, 2008 at 7:41 pm.
"Argyou not with the hand you are dealt in cards or life." ---- Wizard and Glass
•
•
•
•
That's what javaAddict said, Java does not have multiple class inheritance, you can only only extend (is-A) one class. However you can implement (has-A) any amount of interfaces you want.
what jasimp said is correct expect that implementing a interface is *NOT* mean "Has-A" relationship.
Has-A relationship is what when an Class has other Class's object in it's attribute
Implementing a interface is also means "Is-A" relationship
e.g
Java Syntax (Toggle Plain Text)
//for Is-A class Mammal { } class Dog extends Mammal { } //for Has-A class Tail { } class Dog extends Mammal { // Dog IS-A mammal Tail tail ; // and Has-A Tail }
The important thing is not to stop questioning. Curiosity has its own reason for existing.
-Albert Einstein
-Albert Einstein
![]() |
Similar Threads
- need idea for project using classes and inheritance (C++)
- Inheritance (C++)
- Need example of how to use INHERITANCE! (C++)
- C++ BASICS ==> Pointers, Call by Reference/Value, Inheritance, Functions & Arrays (C++)
- Inheritance & Derived Classes (C++)
Other Threads in the Java Forum
- Previous Thread: webcam application startup
- Next Thread: Sending ByteBuffer on TCP and UDP Connection
| Thread Tools | Search this Thread |
Tag cloud for Java
actionlistener android api apple applet application apps arguments array arrays automation balls binary bluetooth card chat class classes client code component consumer database draw eclipse ee error event exception fractal free game gameprogramming gis givemetehcodez graphics gui helpwithhomework html ide image input integer j2me j2seprojects java javaprojects jmf jni jpanel julia jvm key linux list loop machine map method methods migrate mobile mobiledevelopmentcreatejar myaggfun netbeans newbie nextline nls number oracle output print problem program programming project recursion recursive scanner screen security server set size sms socket sort spamblocker sql sqlite string sun swing terminal test threads time tree trolltech windows






