as i’m new to java .so it is very uncomfortable to deal with eclipse. why we use public static void(String[] argument) what does that mean
Related to syntax
- Java only starts running a program with the specific
public static void main(String[] args)
signature, and one can think of a signature like their own name - it’s how Java can tell the difference between someone else’smain()
and the one truemain()
. -
String[] args
is a collection ofString
s, separated by a space, which can be typed into the program on the terminal.
public
-its the access specifier means from every where we can access it;
static
-access modifier means we can call this method directly using a class name without creating an object of it;
void
- its the return type; main
- method name
string [] args
- it accepts only string type of argument… and stores it in a string array (usually not used)
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.