← Back to C# Course | Chapter 1: Setup & Basics | Lesson 3 of 7

Hello World

In this page:

  1. Hello World

Hello World

Every C# program starts execution in a Main method inside a class. Console.WriteLine prints text to standard output followed by a newline. This is the traditional first program used to confirm your setup works.

Note: The using System; line imports the namespace that contains Console.

Example: Hello World

markup
using System;

class Program
{
    static void Main(string[] args)
    {
        Console.WriteLine("Hello, World!");
    }
}
🔒

Chapter Quiz — Complete all 7 topics to unlock

0/7 topics done

Complete these topics first:

Login to run this code

C/C++/Java/PHP execution requires a free account. Your code is saved — you'll land right back in the editor after logging in.