Chapter 4. Hello C#!

Even before we start off with C# syntax and semantics in Part 2, let's do the traditional "Hello World" example just to warm up. This is Hello World, C# version: [1]

[1] Doesn't this look like Java? This familiarity sure gives some confidence doesn't it? At first glance, the Hello World program makes C# look more 'Java-ish' than 'C-ish', but the differences between C# and Java will become more obvious as we progress.

// HelloWorld.cs
public class TestClass{
  public static void Main (){
    System.Console.WriteLine("Hello C#! Here I come!");
  }
}

Get From Java to C#: A Developer's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.