C# for Java Programmers

Chapter 3: Language Fundamentals

Introduction

After familiarizing ourselves with the C# programming environment, it s time to move forward and get to work. You re probably eager to get started and dive right into programming your first full-blown C# enterprise application. Before we can continue, however, we need to learn some subtle differences between C# and Java.

This chapter will go over the basic building blocks of writing a C# application. It will explain all of the language fundamentals such as data types, variables, expressions, and operators. We will learn the difference between namespaces and packages, as well as C# language features not found Java. This includes XML type comments and the preprocessor directives.

As most of you already have some Java programming experience under your belts, this stuff will be a piece of cake. But read it carefully you will want to know the exact differences between Java and C#.

Main() Method

We ll start our overview of C# fundamentals in the same manner that our applications start, with the Main() method. Similar to Java, C# uses the Main() method as the starting point for every application. When an application is executed, it starts by calling the Main() method of the application s controlling class. Additional methods from the same or other classes are then called as needed by the Main() method. Chapter 5 will cover encapsulation and classes in more detail.

Let s examine a quick example of a C# application using the Main() method. Following an ancient tradition, this Hello World ...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Robot Software
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.