- Java Programming for Beginners
- Mark Lassoff
- 240字
- 2021-07-02 15:22:42
The main() function
Java code, like the English language, is read top down and left to right. Even if our project contains many files and many classes, we still need to start reading and executing our code at a specific point. We named this file and class HelloWorld, the same name as our project, because we would like it to be special and contain the public static void main(String[] args) method where the execution of our code will begin. That's quite a mouthful of jargon. For now, just type it out and know that this is the area of our code from where our Java program will begin reading and executing. Once again, this will become much clearer as we begin to learn Java; just know this is the starting point of our Java program. The main() function's code is enclosed in curly brackets:
public class HelloWorld {
public static void main(String[] args) {
}
}
One of the great things about working in an IDE is that it will highlight which brackets correspond to each other. The brackets allow us to place code within other areas of code. For example, our main() method is contained within the HelloWorld class, and the Java code which we're about to write and execute is going to be contained in our main() method. Line 4, which currently contains nothing, is where our program will look to start reading and executing the Java code.
- Learning Cython Programming(Second Edition)
- Beginning Java Data Structures and Algorithms
- OpenStack Cloud Computing Cookbook(Fourth Edition)
- Python金融數據分析
- Java程序設計與實踐教程(第2版)
- 機械工程師Python編程:入門、實戰與進階
- Learning SciPy for Numerical and Scientific Computing(Second Edition)
- 青少年信息學競賽
- Visual C++開發入行真功夫
- App Inventor 2 Essentials
- Backbone.js Testing
- UML基礎與Rose建模實用教程(第三版)
- 數據結構:Python語言描述
- Monitoring Docker
- 程序員的英語