Inheritance

Reply

Join Date: Dec 2008
Posts: 3
Reputation: Simran1 is an unknown quantity at this point 
Solved Threads: 0
Simran1 Simran1 is offline Offline
Newbie Poster

Inheritance

 
0
  #1
Dec 31st, 2008
Hello,
Please tell me in Java we don't have a multiple inheritance? so,in which function we use these inheritance.

Thanks
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 1,649
Reputation: javaAddict is a name known to all javaAddict is a name known to all javaAddict is a name known to all javaAddict is a name known to all javaAddict is a name known to all javaAddict is a name known to all 
Solved Threads: 223
Featured Poster
javaAddict's Avatar
javaAddict javaAddict is offline Offline
Posting Virtuoso

Re: Inheritance

 
0
  #2
Dec 31st, 2008
Originally Posted by Simran1 View Post
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
Check out my New Bike at my Public Profile at the "About Me" tab
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 21
Reputation: chili5 is an unknown quantity at this point 
Solved Threads: 2
chili5's Avatar
chili5 chili5 is offline Offline
Newbie Poster

Re: Inheritance

 
0
  #3
Dec 31st, 2008
What do you mean?

There isn't multiple inheritance in Java. It's a single inheritance only language.
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 3,584
Reputation: jasimp has a spectacular aura about jasimp has a spectacular aura about jasimp has a spectacular aura about 
Solved Threads: 51
Featured Poster
jasimp's Avatar
jasimp jasimp is offline Offline
Senior Poster

Re: Inheritance

 
0
  #4
Dec 31st, 2008
Originally Posted by chili5 View Post
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.
"Argyou not with the hand you are dealt in cards or life." ---- Wizard and Glass
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 1
Reputation: vijendtra is an unknown quantity at this point 
Solved Threads: 0
vijendtra vijendtra is offline Offline
Newbie Poster

Re: Inheritance

 
0
  #5
Jan 1st, 2009
Originally Posted by Simran1 View Post
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....
Reply With Quote Quick reply to this message  
Join Date: Sep 2006
Posts: 80
Reputation: parthiban is an unknown quantity at this point 
Solved Threads: 6
parthiban's Avatar
parthiban parthiban is offline Offline
Junior Poster in Training

Re: Inheritance

 
0
  #6
Jan 1st, 2009
Originally Posted by jasimp View Post
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
  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. }
The important thing is not to stop questioning. Curiosity has its own reason for existing.
-Albert Einstein
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC