Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In an OO language, what do you name your class that contains the Main method? [closed]

For instance in C# or Java, you always have a main() method used to get your program running. What do you name the class that it is in? Some ideas I would use would just be "Program" or the name of the program itself. What would be considered conventional in this case?

like image 340
Joe Phillips Avatar asked Jan 20 '09 16:01

Joe Phillips


People also ask

What is the main Java class called?

The main class can have any name, although typically it will just be called "Main".

What is main method in Java stack overflow?

The method signature of a Java main method is: public static void main(String[] args) { ... } Is there a reason why this method must be static? Java is deliberately designed to look familiar to a C programmer.

What are classes and objects in c#?

Everything in C# is associated with classes and objects, along with its attributes and methods. For example: in real life, a car is an object. The car has attributes, such as weight and color, and methods, such as drive and brake. A Class is like an object constructor, or a "blueprint" for creating objects.


1 Answers

Visual Studio creates "Program.cs" these days, which seems pretty reasonable. Another self-documenting name I rather like is "EntryPoint".

like image 91
Jon Skeet Avatar answered Sep 21 '22 23:09

Jon Skeet