Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-18-2008, 07:20 PM
sivasayanth's Avatar
Member
 
Join Date: Dec 2007
Posts: 20
sivasayanth is on a distinguished road
i couid not get the idea:
In Java, a class can inherit from only one class but it can implement more than one interface


what does it mean? i couldn't understand !
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 01-18-2008, 07:29 PM
tim's Avatar
tim tim is offline
Senior Member
 
Join Date: Dec 2007
Location: South Africa
Posts: 334
tim is on a distinguished road
Hello sivasayanth

Java does not support multiple inheritance. So, you cannot create a child that inherits members from two parents. The solution for this is interfaces. Interfaces allow us to create classes that have related members or attributes to other classes weather they are related by inheritance or not. Let's take an example:
Let's say that we have a class Car and two interfaces Stoppable and Turnable. Also, we have two classes Stop and Turn. If you want your car to be able to stop and turn, you must let the Car class implement the Stoppable and Turnable interfaces. It is not possible to create a class, Car, that is extended from both Stop and Turn.
I hope this helped.
__________________
If your ship has not come in yet then build a lighthouse.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 01-18-2008, 07:52 PM
sivasayanth's Avatar
Member
 
Join Date: Dec 2007
Posts: 20
sivasayanth is on a distinguished road
Hey i got the idea.
thanks a lot
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Got an Idea, Just Share it! james Java Announcements 0 03-18-2008 02:09 PM
anyone can give idea 2 my assignment? chen8735 Advanced Java 2 03-08-2008 08:03 PM
Need a idea on GridBagLayout ddsuresh AWT / Swing 1 01-29-2008 03:32 AM


All times are GMT +3. The time now is 01:25 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org