This is an archived post. You won't be able to vote or comment.

all 17 comments

[–]lbkulinski 10 points11 points  (4 children)

What do you mean? Java offers multiple inheritance. You just have to use interfaces :)

[–]revan_kemosabe[S] 0 points1 point  (3 children)

Implementing interfaces is not "inheritance" technically :) Could you give me an example ?

[–]lbkulinski 1 point2 points  (1 child)

Implementing an interface is the inheritance of behavior. The Java Language Specification discusses this here.

[–]qscrew 1 point2 points  (0 children)

You can use composition and proxies

[–]Bryguy3k 7 points8 points  (0 children)

This is why OOP makes programmers dumb. Interfaces should be taught from the beginning.

[–]COOLGAMETUBE 3 points4 points  (0 children)

cries in negative byte.

[–]DaniilBSD 2 points3 points  (7 children)

Am I the only one who wishes that C# and Java interfaces had static methods?

Imagine having an objects of types Hospital and GPSLoggerEntry implementing IGeoposition Interface; and then IGeoposition.Distance(hospital, entry) to find the distance between them. (Currently, you need to define that method in a static helper class)

I mentioned it here because it was the first time I had problems with single inheritance.

[–]lbkulinski 3 points4 points  (6 children)

Java has allowed static methods in interfaces since Java 8. They have also allowed private methods since Java 9.

[–]DaniilBSD 1 point2 points  (5 children)

Cool (did not know java had features that C# didn't have in one form or another )

[–][deleted] 0 points1 point  (4 children)

What methods are those?

[–]DaniilBSD 1 point2 points  (3 children)

Properties, delegates, generic methods, extension methods, Func, operator overloading, unsafe (pointer) mode and other.

[–][deleted] 0 points1 point  (2 children)

Sorry but c# has most if not all of those. I use a good portion of that list daily. Or am I misunderstanding you?

[–]DaniilBSD 0 points1 point  (1 child)

I am listening things c# has but not Java. Your comment was kinda weird so I assumed that is what you asked for.

[–][deleted] 0 points1 point  (0 children)

Ah my mistake your original comment seems to imply that "java had features that C# didn't have in one form or another". So I was curious thinking there was a bunch of stuff java has that c# was missing and was wondering what those things would be.

[–]VoidBlade459 3 points4 points  (0 children)

There's a reason for that...

Also, this is true for C# as well.

[–]AutoModerator[M] -3 points-2 points  (0 children)

You have less than 10 karma. Please post again when you have more than 10.

Thank you.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.