Java vs C#

15 Jun 2019

Java started out as a very object oriented language. One of the nice things with Java (as a language) has been that the syntax has been quite stable for a long time. C# competes with Java for mainstream developer mind-share. C# has pushed better tooling and more features but was primarily focused on Windows.

For the last few years we have seen .net becoming a truer cross platform language with the .net core project and Microsoft’s acquisition of Xamarin. Due to the push towards micro services and Docker this makes a lot of sense since we will probably see more large scale enterprise software use some sort of micro service architecture to allow scaling of development teams.


Implemented in both

Language Features

Some of the features we know and love in C# is nowadays also part of modern Java:

In the C# corner we are waiting on C# 8 for:

We see that Java uses standard generic class Optional<> with methods while C# uses ?. and ?? operators and uses Nullable<> for value types.


Using Visual Studio Code to develop Java feels very productive. Using Jetbrains Intellij is nicer. I’m not a fan of Eclipse. For C# I usually prefer Visual Studio while Visual Studio Code works and you get some more sweet refactoring in Rider (or through Resharper).

Both Maven and NuGet are mature and enable decomposition into libraries.

Missing features added through extension

The missing part that becomes quite obvious as you start working on any project in Java is the lack of auto properties. However, there is Project Lombok that removes a lot of boilerplate from your code.

You would expect that in C# you’d use t4 template (or Roslyn Source generators) to reduce boilerplate.

Missing features

There isn’t any generic support in the Java runtime. This leads to some weirdness around type erasure.

There isn’t any anonymous interface implementation in C#, but there is in Java (and something similar in F#).



The style of stream and the usage of words are more in line with many other languages (see for instance Javascript, Ruby, Python). Notice the use of map, filter and reduce while in C# LINQ is more in line with SQL. This gives the code a slightly different flavor.

Checked exceptions cause some boilerplate code that becomes a bit more manageable with Result style error handling.


There is validation in Java similar to the familiar attribute based validation in .net.

There are popular MVC frameworks for both. Spring should feel familiar to anyone using MVC.

There are some gotchas, but any .net developer or Java developer should be able to work in both. There might be a short term productivity loss.


Both languages have mature editor support. Many of the bread and butter programming tasks have feature support in both languages. There are some stylistic differences between the languages.



Do you want to send a comment or give me a hint about any issues with a blog post: Open up an issue on GitHub.

Do you want to fix an error or add a comment published on the blog? You can do a fork of this post and do a pull request on github.