public static void main(String[ ] args) | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
0

public static void main(String[ ] args)

Do you always need public static void main(String[ ] args) on your code ? Is it like html where you build the skeleton? 

4th Dec 2019, 5:55 PM
Joe Palmieri
Joe Palmieri - avatar
2 ответов
+ 8
Initially, the code you write in a computer program is just static text lying around passively in a file. To execute the code, the Java Runtime Environment (JRE) is responsible for loading the compiled program and starting its run. To execute the code the JRE needs an entry point.
4th Dec 2019, 9:06 PM
Danijel Ivanović
Danijel Ivanović - avatar
+ 1
For execution of any program, the controls must be transferred to that program by the operating system. main() is that function or method where the control is passed by the operating system in every language whether it be C or Java. That is why, using main() function or method is neccessary. It basically acts as an entry point. https://www.sololearn.com/Discuss/945505/?ref=app https://www.sololearn.com/Discuss/1884803/?ref=app
4th Dec 2019, 6:04 PM
Chetali Shah
Chetali Shah - avatar