class Example{
public static void main(String...args){
S.o.p("HOW");
}
}
class Example {
This line uses the keyword class to declare that a new class is being defined.
The class is Java’s basic unit of encapsulation.
public static void main (String args[]) {
The method is public because it be accessible to the JVM to begin execution of the program.
It is Static because it be available for execution without an object instance. you may know that you need an object instance to invoke any method. So you cannot begin execution of a class without its object if the main method was not static.
It returns only a void because, once the main method execution is over, the program terminates. So there can be no data that can be returned by the Main method
The last parameter is String args[]. This is used to signify that the user may opt to enter parameters to the java program at command line. We can use both String[] args or String args[]. The Java compiler would accept both forms.
public static void main(String...args){
S.o.p("HOW");
}
}
class Example {
This line uses the keyword class to declare that a new class is being defined.
The class is Java’s basic unit of encapsulation.
public static void main (String args[]) {
The method is public because it be accessible to the JVM to begin execution of the program.
It is Static because it be available for execution without an object instance. you may know that you need an object instance to invoke any method. So you cannot begin execution of a class without its object if the main method was not static.
It returns only a void because, once the main method execution is over, the program terminates. So there can be no data that can be returned by the Main method
The last parameter is String args[]. This is used to signify that the user may opt to enter parameters to the java program at command line. We can use both String[] args or String args[]. The Java compiler would accept both forms.
No comments:
Post a Comment