Can parameters passed to the main function be empty? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can parameters passed to the main function be empty?

25th Sep 2016, 9:28 PM
Supriya P
4 Answers
+ 1
Yes.
25th Sep 2016, 11:05 PM
Zen
Zen - avatar
0
yes
25th Sep 2016, 11:11 PM
Mansi Verma
Mansi Verma - avatar
0
then whats the use of it ??? zen !!
26th Sep 2016, 7:29 PM
Bhushan Gaikwad
Bhushan Gaikwad - avatar
0
Yes, obviously. But, for a stand-alone JAVA program to compile, you need to have: public static void main(String[] args) or public static void main(String args[]) where you may give any valid variable instead of 'args' ... Any other method with the name 'main()' can be inside your code with or without parameters, but that will become overloading of the main method !!!
4th Dec 2017, 4:27 PM
friendly_nadim
friendly_nadim - avatar