Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What is diamond Problem Faced in Multiple inheritence in java ?

 
Prabhat Ranjan
Ranch Hand
Posts: 397
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Any one knows about the diamond problem in java Interface.

Please explain with example.

Regards,
Prabhat
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here you go: Diamond problem. Java doesn't support multiple inheritance, so it doesn't have this issue.
 
Wouter Oet
Saloon Keeper
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
He is not asking about the diamond problem in combination with inheritance but in combination with interfaces. And it does exist:


But I don't have a solution for you
 
Campbell Ritchie
Sheriff
Posts: 48910
58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think that is a problem; I am pretty sure that code won't compile: no compilation, no problems at runtime
 
Wouter Oet
Saloon Keeper
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just don't write ANY code AT ALL. Then you don't need to compile anything and you will have no runtime-errors
 
Campbell Ritchie
Sheriff
Posts: 48910
58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Touche. Even Joanne Neal wouldn't have produced a comeback like that
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic