+ 1
What does the following code in java?
public static void main
5 Answers
+ 15
+ 3
public = accessible from anywhere within the same project
static = can run this method without making an instance of it
void = there is no specific return type/ it is just executing what's inside the method
main = name of the "main method", every java program starts at
+ 1
ok
+ 1
in the sense of main method it is such because -
public - it needs to accessed from outside of class
static - because it needs to be executed fast so jre doesn't need to create object for it.
void - again as it needs to be executed fast it doesn't return anything.
main(String args[]) it will take all argument in form of string.