Your First C# Program - CSharp Language Basics

CSharp examples for Language Basics:Hello World

Introduction

Here is a program that multiplies 2 by 3 and prints the result, 6, to the screen.

The double forward slash indicates that the remainder of a line is a comment:

Demo Code

using System;                     // Importing namespace
class Test                        // Class declaration
{
   static void Main()              // Method declaration
   {/*from ww  w.j a va2  s.  c  o  m*/
      int x = 2 * 3;                // Statement 1
      Console.WriteLine (x);        // Statement 2
   }                               // End of method
}                                 // End of class

Result


Related Tutorials