simple question
-
hi , this may sound very stupid but i want some body to explain to me what is the difference between public static void Main() { } AND public void Main() { } what is the purpose of using void in the main function ie anyway a main function doesnot have to return any values right :D expecting a reply at the earliest j
-
hi , this may sound very stupid but i want some body to explain to me what is the difference between public static void Main() { } AND public void Main() { } what is the purpose of using void in the main function ie anyway a main function doesnot have to return any values right :D expecting a reply at the earliest j
Trustapple wrote:
expecting a reply at the earliest
Read this [^] article.
Trustapple wrote:
what is the purpose of using void in the main function ie anyway a main function doesnot have to return any values
You use void to let the compiler know that the function doesn't return any values.
There are 10 kinds of people: those who understand binary and those who don't
-
hi , this may sound very stupid but i want some body to explain to me what is the difference between public static void Main() { } AND public void Main() { } what is the purpose of using void in the main function ie anyway a main function doesnot have to return any values right :D expecting a reply at the earliest j
Hi..
Trustapple wrote:
public static void Main()
public: It means that this method can be accessed from anywhere.... static: without creating the object of this class we can call the methos directly by using its class name... void: As this main method is a function it should return something so we specifying void which means that it will not return any value... main: it is a function name where the program starts executing...you can call this function from any other functions tooo like.... public void callMain() { main(); }
Regards, Sandeep Kumar.V