Do you know what do you mean of
“public static void main()”?
Public
It is “access specifier” ; so it is basically define the scope of methods, classes and interface and etc. you know JRE (Java Run-time Environment) is the outside part of class. if we use other access specifier (private, protected) so you can’t access the that class. If you are not used any access specifier. So compiler use the default access specifier.
It is “access specifier” ; so it is basically define the scope of methods, classes and interface and etc. you know JRE (Java Run-time Environment) is the outside part of class. if we use other access specifier (private, protected) so you can’t access the that class. If you are not used any access specifier. So compiler use the default access specifier.
Static
In class there are two type members
In class there are two type members
1-Instance member
represent attributes and behavior of individual object. By default all the member of class is instance member.
represent attributes and behavior of individual object. By default all the member of class is instance member.
2-class member
represent attributes and behavior of whole class. Denoted by “static” keyword.
represent attributes and behavior of whole class. Denoted by “static” keyword.
So static keyword are used define the class member.
Void
Functions are always requires a return type so void is one of them to returns value implicitly. If any error occur in the program so O.S returns the value with the help of JRE.
Functions are always requires a return type so void is one of them to returns value implicitly. If any error occur in the program so O.S returns the value with the help of JRE.
Main:
only method name
only method name
Are you know the given below syntax
are valid or not valid in JAVA?
Syntex-(Modifier
ReturnType MethodName() )
Static public void main
(String [] arg ) true
Static public void
main(String[][] arg) runtime error NoSuchMethodError
Static void public
main (String [][] arg) compile time error
Void static public
main (String arg[]) compile time error
public static void main (String arg) runtime error
NoSuchMethodError
Public void static
main ([] String arg) compile time error
Public static void
main (String[] arg[]) runtime error NoSuchMethodError
Public static void
main() runtime error NoSuchMethodError