五月天青色头像情侣网名,国产亚洲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的評論 (共 條)

分享到微博請遵守國家法律
北碚区| 延川县| 禄丰县| 祁阳县| 射阳县| 平塘县| 旌德县| 博湖县| 阜宁县| 砀山县| 秀山| 连州市| 通榆县| 天长市| 和硕县| 沾益县| 剑川县| 西充县| 嘉兴市| 平度市| 喀喇| 青龙| 安西县| 井陉县| 公安县| 达州市| 广河县| 射阳县| 兰坪| 历史| 江门市| 茌平县| 清远市| 谢通门县| 平舆县| 大厂| 澎湖县| 樟树市| 西峡县| 宜兴市| 台前县|