Java for C# developers — Mission
Why I’m learning this
Section titled “Why I’m learning this”I think in C#. But much of the code I read every day is Java: Spring services, build plugins, libraries whose C# port lags behind. The two languages look so alike that it is easy to write Java as if it were C#, and to be surprised at run time: == on two Integers, a generic type that has vanished, a checked exception that won’t compile.
This course is the map I wanted: for each topic, what carries over from C#, what only looks the same, and what has no equivalent.
Who this course is for
Section titled “Who this course is for”You write C# comfortably: classes, interfaces, generics, LINQ, async/await, NuGet and the dotnet CLI. You have read some Java but never shipped it. A follow-up course, Spring Boot, Spring Cloud and Reactor for C# developers, builds on this one.
By the end of this course, I will be able to
Section titled “By the end of this course, I will be able to”- install a JDK, run Java code and build a project with Maven or Gradle;
- predict where Java’s value semantics, equality and numbers differ from C#;
- model data with classes, records, enums and sealed interfaces;
- use generics knowing what type erasure takes away;
- handle checked exceptions,
nullandOptional; - translate LINQ and delegates into Streams and functional interfaces;
- write concurrent code with virtual threads instead of
async/await; - test, package and run a Java application on the JVM.
Outline
Section titled “Outline”| # | Lesson | You already know |
|---|---|---|
| 1 | The JDK and build tools | the .NET SDK, dotnet run, NuGet, .csproj |
| 2 | Types, equality and operators | value types, checked, ==, string interpolation |
| 3 | Classes, records and enums | properties, virtual/override, record, enum |
| 4 | Generics and type erasure | reified generics, where T : new(), in/out variance |
| 5 | Exceptions, null and Optional (coming next) |
exceptions, using, nullable reference types |
| 6 | Lambdas and functional interfaces | delegates, Func/Action, events |
| 7 | Collections and Streams | List<T>, Dictionary, LINQ |
| 8 | Pattern matching | switch expressions, is patterns, records |
| 9 | Concurrency and virtual threads | Task, async/await, lock, Parallel |
| 10 | Maven and Gradle in depth | NuGet, Central Package Management, solutions |
| 11 | Testing | xUnit, Moq, FluentAssertions |
| 12 | The standard library you reach for | DateTime, decimal, HttpClient, System.IO |
| 13 | The JVM at run time | the CLR, GC settings, dotnet-counters, Native AOT |
| 14 | Annotations, reflection and modules | attributes, source generators, assemblies |
Journal — what I tried, what surprised me, what I still need to verify.
Resources
Section titled “Resources”- dev.java — Oracle’s official Java tutorials, up to date with recent releases.
- The Java Language Specification, Java SE 25 — the reference when two tutorials disagree.
- Java SE 25 API documentation.
- OpenJDK JEP index — every language and JVM change, with its motivation.
- Maven — Getting Started and the Gradle user manual.