- 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 Scala Programming
- ASP.NET Core:Cloud-ready,Enterprise Web Application Development
- Three.js開發(fā)指南:基于WebGL和HTML5在網(wǎng)頁上渲染3D圖形和動畫(原書第3版)
- 三維圖形化C++趣味編程
- R語言數(shù)據(jù)可視化實戰(zhàn)
- 用Flutter極速構(gòu)建原生應(yīng)用
- Nginx實戰(zhàn):基于Lua語言的配置、開發(fā)與架構(gòu)詳解
- Building Android UIs with Custom Views
- 好好學(xué)Java:從零基礎(chǔ)到項目實戰(zhàn)
- 打開Go語言之門:入門、實戰(zhàn)與進階
- 深入實踐DDD:以DSL驅(qū)動復(fù)雜軟件開發(fā)
- Building Slack Bots
- Neo4j 3.x入門經(jīng)典
- 數(shù)據(jù)庫技術(shù)及應(yīng)用教程上機指導(dǎo)與習(xí)題(第2版)
- 計算機輔助設(shè)計與繪圖技術(shù)(AutoCAD 2014教程)(第三版)