Sorry for a naive question. I learn programming in Java and have a question on the very beginning.
I follow Lesson: A Closer Look at the "Hello World!" Application, where you can found the following code.
class HelloWorldApp {
public static void main(String[] args) {
System.out.println("Hello World!"); // Display the string.
}
}
Having some experience in programming in C++ this code for me looks rather bizarre.
Class HelloWorldApp contains a starting point to application, for me it looks very strange, because of many points, for example, in order to get this work I thought we need somehow to evoke the method main because it is in class, however it works as it is. If I would have several classes (nor I am not sure if it's ok in java app? but, in general it should be ok), so I could define several starting points in app?
What the reason to define staring point into the class?
mainmethod is the starting point of a Java application.int main(). 3) In Java, a program is also started (either implicitly or explicitly) frommain (). 4) Since Java has no "standalone functions" (only classes), main MUST be a class method. 4) Unlike C/C++, Java allows you to have MULTIPLE main functions. 5) This allows you to choose among one or more runtime entry points for you program. See my response below for more details.