943,551 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 623
  • Java RSS
Dec 31st, 2008
0

Inheritance

Expand Post »
Hello,
Please tell me in Java we don't have a multiple inheritance? so,in which function we use these inheritance.

Thanks
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Simran1 is offline Offline
3 posts
since Dec 2008
Dec 31st, 2008
0

Re: Inheritance

Click to Expand / Collapse  Quote originally posted by Simran1 ...
Hello,
Please tell me in Java we don't have a multiple inheritance? so,in which function we use these inheritance.

Thanks
You say:
> 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
Sponsor
Featured Poster
Reputation Points: 1014
Solved Threads: 446
Nearly a Senior Poster
javaAddict is offline Offline
3,258 posts
since Dec 2007
Dec 31st, 2008
0

Re: Inheritance

What do you mean?

There isn't multiple inheritance in Java. It's a single inheritance only language.
Reputation Points: 12
Solved Threads: 2
Newbie Poster
chili5 is offline Offline
21 posts
since Dec 2008
Dec 31st, 2008
0

Re: Inheritance

Click to Expand / Collapse  Quote originally posted by chili5 ...
What do you mean?

There isn't multiple inheritance in Java. It's a single inheritance only language.
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.
Featured Poster
Reputation Points: 533
Solved Threads: 53
Senior Poster
jasimp is offline Offline
3,593 posts
since Aug 2007
Jan 1st, 2009
0

Re: Inheritance

Click to Expand / Collapse  Quote originally posted by Simran1 ...
Hello,
Please tell me in Java we don't have a multiple inheritance? so,in which function we use these inheritance.

Thanks
c there is no concept of multiple inheritance in java but some time it seems that there may be a multiple inheritence....
Reputation Points: 10
Solved Threads: 0
Newbie Poster
vijendtra is offline Offline
1 posts
since Dec 2008
Jan 1st, 2009
0

Re: Inheritance

Click to Expand / Collapse  Quote originally posted by jasimp ...
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.
Hi Sriran1 ,

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)
  1. //for Is-A
  2. class Mammal {
  3. }
  4.  
  5. class Dog extends Mammal { }
  6.  
  7. //for Has-A
  8.  
  9. class Tail { }
  10.  
  11. class Dog extends Mammal { // Dog IS-A mammal
  12. Tail tail ; // and Has-A Tail
  13. }
Reputation Points: 10
Solved Threads: 6
Junior Poster in Training
parthiban is offline Offline
80 posts
since Sep 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: webcam application startup
Next Thread in Java Forum Timeline: Sending ByteBuffer on TCP and UDP Connection





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC