Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
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 04-03-2008, 12:27 PM
Member
 
Join Date: Jan 2008
Posts: 11
Sayed is on a distinguished road
help
one class can implement multiple interfaces but it can't extend two calsses why??????

Last edited by Sayed : 04-03-2008 at 12:32 PM.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 04-03-2008, 12:34 PM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 2,405
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Multiple inheritance, means one class directly can't extend two classes.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Has someone helped you? Then you can
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.

Want to make your IDE the best?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
(Close on July 13, 2008)
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 04-03-2008, 12:41 PM
Member
 
Join Date: Jan 2008
Posts: 11
Sayed is on a distinguished road
i want the exact reason for that??..what will be the problem if one class extends multiple calsses directly...one class can implement multiple interfaces directly right...
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 04-03-2008, 12:53 PM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 2,405
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
That is because to avoid dangers like ambiguity that is present in C++, you may know.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Has someone helped you? Then you can
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.

Want to make your IDE the best?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
(Close on July 13, 2008)
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 04-03-2008, 01:00 PM
Member
 
Join Date: Jan 2008
Posts: 11
Sayed is on a distinguished road
Thanks for your respone ......could you please brief me on that????what danger it is????
Bookmark Post in Technorati
Reply With Quote
  #6 (permalink)  
Old 04-03-2008, 01:09 PM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 2,405
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Oh dear, say ClassA extend from ClassB and ClassC. Say ClassB has a method sampleMethod() and ClassC has sampleMethod(), which method ClassA should call. Compiler really mess-up with it.

That's why SUNs' avoid this. So you can simply use interfaces. As I said there is a trick for multiple inheritance also.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Has someone helped you? Then you can
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.

Want to make your IDE the best?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
(Close on July 13, 2008)
Bookmark Post in Technorati
Reply With Quote
  #7 (permalink)  
Old 04-03-2008, 01:19 PM
Member
 
Join Date: Jan 2008
Posts: 11
Sayed is on a distinguished road
Thanks yaar...Thanks a lot for your help...
Bookmark Post in Technorati
Reply With Quote
  #8 (permalink)  
Old 04-03-2008, 01:21 PM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 2,405
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Is that clear for you. If the question is solved don't forget what I say
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Has someone helped you? Then you can
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.

Want to make your IDE the best?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
(Close on July 13, 2008)
Bookmark Post in Technorati
Reply With Quote
  #9 (permalink)  
Old 04-03-2008, 01:28 PM
Member
 
Join Date: Jan 2008
Posts: 11
Sayed is on a distinguished road
But what about interfaces???if two interfaces contains same method compiler won't mess-up...
Bookmark Post in Technorati
Reply With Quote
  #10 (permalink)  
Old 04-03-2008, 01:37 PM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 2,405
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Did you try it?
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Has someone helped you? Then you can
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.

Want to make your IDE the best?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
(Close on July 13, 2008)
Bookmark Post in Technorati
Reply With Quote
  #11 (permalink)  
Old 04-03-2008, 01:57 PM
Member
 
Join Date: Jan 2008
Posts: 11
Sayed is on a distinguished road
yes i tried it...it is not showing any compilation problem but the actual implemented method is not executing...could u please help me on this....
Bookmark Post in Technorati
Reply With Quote
  #12 (permalink)  
Old 04-03-2008, 01:59 PM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 2,405
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
What you mean actual implemented method is not executing. I'm not clear with it. Do you have any code with you.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Has someone helped you? Then you can
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.

Want to make your IDE the best?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
(Close on July 13, 2008)
Bookmark Post in Technorati
Reply With Quote
  #13 (permalink)  
Old 04-03-2008, 02:13 PM
Member
 
Join Date: Jan 2008
Posts: 11
Sayed is on a distinguished road
Sorry Its executing it is not showing any problems.
Bookmark Post in Technorati
Reply With Quote
  #14 (permalink)  
Old 04-03-2008, 02:14 PM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 2,405
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Ok, so you overloading methods, right?
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Has someone helped you? Then you can
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.

Want to make your IDE the best?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
(Close on July 13, 2008)
Bookmark Post in Technorati
Reply With Quote
  #15 (permalink)  
Old 04-03-2008, 02:16 PM
Member
 
Join Date: Jan 2008
Posts: 11
Sayed is on a distinguished road
Please have a look on this code:

public class Test implements Sample1,Sample2{
public static void main(String args[]){
System.out.println("public static void main");
Test t=new Test();
t.jen();
}
public void jen() {
System.out.println("Success");

}

}

Interface 1:

ublic interface Sample1 {

public void jen();


}

Interface:2


public interface Sample2 {
public void jen();

}
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



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


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