CSharp - What is the output: constructor return type

Question

What is the output from the following code

using System;
class MyClass
{
    public MyClass()
    {
        Console.WriteLine("A Constructor with no argument");
    }
    public void MyClass()
    {
        Console.WriteLine("a method");
    }
}


Click to view the answer

Java allows this but the C# compiler will raise an error.

Note

You cannot specify the return type for constructor.

Related Quiz