Hello guys I'm new to C# programming. I'd like to know what's the equivalent of this Java static to C#?

class NMM 
{
public static void main(String []args)
{
System.out.println("java");
}


static 
{
System.out.println("great");
NMM.main(null);
System.out.println("programmer");
System.exit(0);

}

}

Any help would be appreciated.

Recommended Answers

All 4 Replies

I changed to

static NMN(){ 
Console.Write("great"); 
NMN.Main(null);
Console.Write("programmer");

}

but it didn't display the programmer text.

I can get it to display just fine. Could you post your entire program?

this one:

class Program
    {
        static void Main(string[] args)
        {
            Console.Write("java");
        }

        static Program() 
        {
            Console.Write("great ");
            Program.Main(null);
            Console.Write(" programmer");
        }
    }

hey friend I got it already I put the ReadLine() after Console.Write(" programmer");

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.