O'Reilly logo

C# for Java Developers by Adam Freeman, Allen Jones

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 4. Language Syntax and Features

This chapter details the basic syntax, structure, and features of the C# language. We expect the reader to be familiar with the Java language, and we concentrate on C# features that are new or different.

General Program Structure

We begin with a simple program example to demonstrate the basic points that must be understood when writing C# code. The following Java code should be familiar:

public class Hello {
    public static void main(String[] args) {
        System.out.println("Hello World!");
    }
}

Contrast it with the following C# code:

using System;

public class Hello {
    public static void Main(String[] args) {
        Console.WriteLine("Hello World!");
    }
}

Although obvious similarities exist, the following points should be noted: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required