r/learnjava • • Jun 21 '21

Why learn Java when there's C#?

I am genuinely curious, as it seems C# has superseded Java in many regards. The only reason I can think of using Java is backward compatibility.

EDIT: To clarify, the main selling point of Java was cross-platform, but nowadays most frameworks and toolsets are to some degree cross-platform, including .NET Core, which is the new main framework of C#.

0 Upvotes

36 comments sorted by

View all comments

Show parent comments

6

u/sweetno Jun 21 '21

Usually it comes down to the point "Deeply integrated with Windows" which doesn't play well with all these Linux servers everywhere.

1

u/kres0345 Jun 21 '21

Yea, that's the cross-platform part I mentioned in the edit of my OP. As another redditor mentioned, the post is apparently old. C# isn't deeply "integrated with windows", the original DotNet Framework has got it's last version update and is already a couple major releases behind, the new main framework is .NET Core a cross-platform alternative

1

u/[deleted] Jun 21 '21

[removed] — view removed comment

0

u/kres0345 Jun 21 '21

Well that's because the multiple codebases are built-into the language and hidden from the programmer. I'm sure you can find libraries that present cross-platform interfaces for doing things

3

u/DuncanIdahos9thGhola Jun 21 '21

Well that's because the multiple codebases are built-into the language and hidden from the programmer.

WTF does that even mean?

I'm sure you can find libraries that present cross-platform interfaces for doing things

Not really. There's not many libraries out there compared to Java out there.

0

u/kres0345 Jun 22 '21

"WTF does that even mean?"

Well, it isn't magic that communicates with the different platforms, at some level it would have to bifurcate into different "codebases" addressing the specifics of the system.

I would like to emphasize that I already don't like the parent commenters use of the word "codebase", I think it implies there's a need to write the entire codebase twice with minor differences, this is very naïve. Having an if-statement check the platform and run a line of code instead of another according to the platform is hardly called a different "codebase".

What I meant is that this is hidden away in the standard library of Java, while in C# you'd just such a library yourself to address different platform needs.