五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

【Day-2】Java自學(xué)筆記 - HelloWorld

2023-01-03 00:18 作者:浩淚  | 我要投稿

1.Java程序的過程能夠被簡化為三步:

? 在文本編輯器輸入和把它保存成文件 -?HelloWorld.java

? terminal窗口編譯這個文件 - javac HelloWorld.java

??terminal窗口運(yùn)行這個文件 - java HelloWorld.java

2.Hello World

Ouput:?

3.分析一下上面的代碼

時間復(fù)雜度:O( 1 ).? ?// 待分析

空間復(fù)雜度:O( 1 ).? ?// 待分析

<1>. class定義 -?使用Class關(guān)鍵字來聲明了一個新類

<2>. HelloWorld - 類名

<3>. main方法

在Java編程語言中,每一個應(yīng)用都應(yīng)該包含一個main方法。main方法時Java程序的主入口。而且它是強(qiáng)制性的。

? public :JVM無論在哪都可以執(zhí)行main方法

? static :? 主要方法是在沒有對象的情況下調(diào)用。修飾符public和static可以按任意順序編寫?. [ ? ]

? void : main方法沒有返回任何東西

??main() :?JVM中配置的名稱。main方法必須在類定義內(nèi)。編譯器總是從主函數(shù)開始執(zhí)行代碼。[?Name configured in the?JVM. The main method must be inside the class definition. The compiler executes the codes starting always from the main function. ]?

??String[] :?main方法接受單個參數(shù),即String類型的元素?cái)?shù)組。

4. 注意點(diǎn)

?? 程序定義的類名為HelloWorld,與文件名(HelloWorld.java)相同。這不是巧合。在Java中,所有代碼都必須駐留在一個類中,并且最多有一個公共類包含main()方法。【?The name of the class defined by the program is HelloWorld, which is the same as the name of the file(HelloWorld.java). This is not a coincidence. In Java, all codes must reside inside a class, and there is at most one public class which contains the main() method.

???按照慣例,主類(包含主方法的類)的名稱應(yīng)該與保存程序的文件的名稱匹配。【?By convention, the name of the main class(a class that contains the main method) should match the name of the file that holds the program.

???每個Java程序都必須有一個與文件名匹配的類定義(類名和文件名應(yīng)該相同)。【 Every Java program must have a class definition that matches the filename (class name and file name should be same). 】

5. sout

System.out.println("Hello, World"); - 可以通過在idea里打sout快速生成。這個會在控制臺輸出Hello,World


【Day-2】Java自學(xué)筆記 - HelloWorld的評論 (共 條)

分享到微博請遵守國家法律
澄城县| 宁陵县| 泰安市| 阳原县| 观塘区| 新民市| 诏安县| 广灵县| 句容市| 临夏市| 庆城县| 平凉市| 郓城县| 睢宁县| 淳安县| 克东县| 繁峙县| 金溪县| 灵璧县| 四平市| 临湘市| 宁海县| 静海县| 龙陵县| 闽清县| 玉环县| 通海县| 巴马| 杨浦区| 满洲里市| 安仁县| 白城市| 庄河市| 海原县| 北流市| 庆安县| 仁寿县| 绥德县| 云南省| 合作市| 襄汾县|