What's wrong with my code? Why can't I output the "hahahaha" string from public constructor1?? help me please.

using System;

namespace hahahahahahahahaha
{
	class Program
	{
		public static void Main(string[] args)
		{
			
			constructor1  obj = new constructor1();
		}
	}
	
	
	public class constructor1
	{
		public constructor1();
		{
			
			Console.WriteLine("hahahaha");
			
		}
	}
	
}

do it:

using System;

namespace hahahahahahahahaha
{
	class Program
	{
		public static void Main(string[] args)
		{
		       constructor1  obj = new constructor1();
                       Console.ReadLine(); //need to insert this line of code to show console!
		}
	}
	
	
	public class constructor1
	{
		public constructor1();
		{			
			Console.WriteLine("hahahaha");			
		}
	}	
}

do it:

using System;

namespace hahahahahahahahaha
{
	class Program
	{
		public static void Main(string[] args)
		{
		       constructor1  obj = new constructor1();
                       Console.ReadLine(); //need to insert this line of code to show console!
		}
	}
	
	
	public class constructor1
	{
		public constructor1();
		{			
			Console.WriteLine("hahahaha");			
		}
	}	
}

It's still not working for me...

C# Syntax (Toggle Plain Text)

    using System;
     
    namespace hahahahahahahahaha
    {
    class Program
    {
    public static void Main(string[] args)
    {
    constructor1 obj = new constructor1();
    Console.ReadLine(); //need to insert this line of code to show console!
    }
    }
     
     
    public class constructor1
    {
    public constructor1(); //<--Delete the Semicolon and then it will work ;)
    {
    Console.WriteLine("hahahaha");
    }
    }
    }

hehe, indeed! You must delete that semicolon there!! Didnt see it.
Must be something wrong with the webiste - it wasnt responcive for a while.
Sorry for that.

Edited 5 Years Ago by Mitja Bonca: n/a

This article has been dead for over six months. Start a new discussion instead.