answersLogoWhite

0

Why do you write void to the first of main?

Updated: 8/17/2019
User Avatar

Wiki User

15y ago

Best Answer

Because main is the first method being executed, the Java Virtual Machine cannot expect any return values from this method.

Since void is the term used to refer to a variable that does not return any value, we use the key word void for the method signature of the main method

User Avatar

Wiki User

15y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Why do you write void to the first of main?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Why do you write void to the first of main in c?

This is really unclear. If you're asking why you should write void main() then the answer is that you shouldn't. main can return an int as an error code, so it's better to do int main() instead.


Why to write void main in c programing?

it is always not necessary to write "void main " in c programming.it depends on the source code we use if we have to return a value then void is not necessary because void returns the null.While coding in borland C++ we need to write void main but we dont need it in dav c++.In C (and C++) the standard allows int main (void) and int main (int argc, char **argv)


Why not write static public void main?

You can write. The order of these words does not make any difference.


Write a c program to have followiing as output?

void main() { printf("followiing"); }


Write a program for 3x3 matrix?

#include<stdio.h> #include<conio.h> void main()


Is it compulsory to write static with void main?

Every C# application is started on the startup class' static Main method. Yes, it must be static, but void is not the only returned type. The 4 signatures:static void Main();static void Main(string[] arguments);static int Main();static int Main(string[] arguments);Ideally, there should be one and only one Main method in your application.


How many essential functions are required to write a c program and write those?

One.int main (void) { return 0; }


How do you write the program for the hexadecimal 210?

int main (void) { puts ("210H"); return 0; }


What if you write static public void instead of public static void?

It would actually make no difference. The presence of the keywords during the declaration of the main method is important and not the order. so a static public void main(String[] args) would just compile and run perfectly fine just like public static void main(String[] args)


Can you write a program with C?

#include <stdio.h> int main (void) { puts ("Yes, I can"); return 0; }


Write a c program for alphabetical order?

int main (void) { puts ("ABCDEFGHIJKLMNOPQRSTUVWXYZ"); return 0; }


Write a program in cpp to print the charminar?

int main (void) { puts ("charminar"); return 0; }