How to execute the main(String[]) method
Before diving into the garbage collection process, we would like to review and summarize how to run an application from a command line. In Java, the following statements are used as synonyms:
- Run/execute main class
- Run/execute/start application
- Run/execute/start main method
- Run/execute/start/launch JVM or Java process
The reason for that is that each of the listed actions happens every time you execute one of them. There are also several ways to do it. We have already shown you how to run the main(String[])
method using IntelliJ IDEA and the java
command line. Now, we will just repeat some of what has been said already and add other variations that might be helpful for you.
Using IDE
Any IDE allows running the main method. In IntelliJ IDEA, it can be done in three ways:
- By clicking on the green arrow next to the method name
- By selecting the class name from the drop-down menu (at the top line, to the left of the green arrow) and clicking the green arrow to...