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");
			
		}
	}
	
}

Recommended Answers

All 6 Replies

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!!

hehe, indeed! You must delete that semicolon there!! Didnt see it.

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.