Can we change main functions syntax?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Can we change main functions syntax??

every language has got some fixed syntax of its main method . can we make any changes in that function? Is it defined to the compiler which will cause an error? for eg: can the int main() be altered to void main or any other type or public static void main(String ags[]) can we change it to int main will any changes in main functions syntax cause any compiler error

22nd May 2019, 3:04 PM
Ayush Pandey
Ayush Pandey - avatar
8 Answers
+ 3
I have not tried but may be if you changes the configuration of the compiler.
22nd May 2019, 3:07 PM
Abhinav
+ 3
Sorry got it!
22nd May 2019, 5:20 PM
Ayush Pandey
Ayush Pandey - avatar
+ 2
~ swim ~ can u be more detailed on ur last point
22nd May 2019, 4:31 PM
Ayush Pandey
Ayush Pandey - avatar
+ 2
Got it somehow😁
22nd May 2019, 5:01 PM
Ayush Pandey
Ayush Pandey - avatar
+ 2
Well it's still no satisfied wether int can be used in java main function without altering compiler's code
22nd May 2019, 5:02 PM
Ayush Pandey
Ayush Pandey - avatar
+ 2
~ swim ~ what do you do as profession
22nd May 2019, 5:21 PM
Ayush Pandey
Ayush Pandey - avatar
+ 1
Abhinav Bhardwaj it's quite curious as the basic concept is correct wether use void or int . looking fore some more answers
22nd May 2019, 3:12 PM
Ayush Pandey
Ayush Pandey - avatar
+ 1
static final public synchronized strictfp void main( String ... whatEver) {} // this is valid
22nd May 2019, 5:53 PM
zemiak