+ 5
C# vs java
Testing C# I notice that data structures, syntax and methods are "inspired by"/"copied from" java. What are the advantages of C# over java ? Has C# extra interesting language features that java hasn't ? Or is it only a Microsoft copy of java ?
12 Answers
+ 8
For me C# has nicer syntax overall.
Async/await syntax makes asynchronous calls so much easier.
With .NET core programs are truly multiplatform.
Ref/in/out keywords.
Linq as pointed by Tibor Santa.
Better Generics.
More access modifiers (internal, private protected), which give you more control over scope of your code.
Public properties (no need for writing setters and getters all the time).
When you wanna play with webdev you just create ASP.NET Core project and that's it, in Java you have to configure Spring like whole day.
That's a few from the top of my head ^^
+ 12
Having worked with both Java and C# since they both were released, I believe strongly that Java has failed to measure up to its potential.
Compared to C# and even Kotlin, Java is an antiquated language that is only popular from its momentum caused by its earlier days and adoption in universities.
To learn more about specific details, check out these two posts:
https://www.sololearn.com/post/183509/
https://www.sololearn.com/post/117714/
+ 3
Mirielleđ¶ don't take it personally, and I appreciate your opinion if you can elaborate, what exactly (which features) make C# more powerful for you.
Peace! :) đ€Ł
+ 2
Actually both languages are spinoffs of C++ created with the intent to fix its drawbacks... Hence their syntax is very similar and so is their core toolset. Java is older and carries a lot of technical baggage, there is tons of legacy code in enterprises on old java versions that is difficult to maintain or upgrade. Now Java has become open source and more or less free from the clutches of Oracle, so it has a chance to revive and new features are added constantly.
C# works best in the Microsoft world (with Windows, Azure, MSSQL etc.) but dotnet is also multiplatform now. Some say C# is very well designed and more convenient than Java, has less boilerplate code and easier management of external libs. I think it is a matter of preference :)
https://www.sololearn.com/Discuss/1822811/?ref=app
+ 2
Instead of starting a religious war over which is better (without external references), I suggest to focus on the question: does C# have any unique feature that is missing from Java?
Syntax variations aside, Linq in C# is probably one of those features. It allows to talk with any enumerable type (including database records) in a uniform way, and has an SQL-like alternative syntax. Maybe Java Streams come close in functionality, but slightly less capable.
If anyone knows and has used both languages extensively, they might be able to point out additional such features I overlooked...
0
Guys .exe :)
- 1
I love Java ;)
- 2
I would say Java.