Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

C# C# Basics C# Syntax Hello, World!

Freddy Castillo
Freddy Castillo
4,389 Points

In the Main method, call the System.Console.WriteLine method and have it print the string "Hello!". Having an issue

Having an issue with this one

Program.cs
class Program
{
    static void Main(string[] args)
    {
      System.Console.WriteLine

    }
}

1 Answer

Steven Parker
Steven Parker
218,596 Points

When you submit this code, you'll see this result:

Bummer: We got a "; expected" error, which could mean a couple different things. It might mean you didn't end your statement in a semicolon. But it could also mean you didn't put parentheses after System.Console.WriteLine.

In this case, both issues are present. To call a method, you need both the method name and a pair of parentheses following it. Inside the parentheses you put any argument(s) you wish to pass to the method (here that would be the string to be printed). And of course, all statements should end with a semicolon.