我的第一個JAVA程序:Helloworld

我的第一個JAVA程序:Helloworld

1.創(chuàng)建文件夾存放代碼

2.新建一個java文件

  • 文件后綴名為.java

  • Hello.java

  • 【注意】系統(tǒng)顯示文件后綴名才能更改

3.編寫代碼

<pre class="md-fences md-end-block ty-contain-cm modeLoaded" spellcheck="false" lang="java" cid="n12" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 4px 6px; margin-bottom: 15px; margin-top: 15px; width: inherit; color: rgb(51, 51, 51); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">public class Hello{
public static void main(String[] args){
System.out.print("Hello,World");
}
}</pre>

4.在cmd命令行中進入同級文件夾

輸入Dos命令:Javac Hello.java

文件夾里會生成一個class文件

【注意事項】

  • 每個單詞的大小寫有嚴格要求,拼寫順序不能出錯

  • 輸出中文可能會出現(xiàn)亂碼

  • 文件名與類名必須保持一致,并首字母大寫

  • 不能使用中文符號

5.輸入Dos命令:Java Hello**

成功打印Hello,World.jpg

打印成功,完成我的第一個java程序

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容