我的第一個(gè)JAVA程序:Helloworld
1.創(chuàng)建文件夾存放代碼
2.新建一個(gè)java文件
文件后綴名為.java
Hello.java
【注意】系統(tǒng)顯示文件后綴名才能更改
3.編寫(xiě)代碼
<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命令行中進(jìn)入同級(jí)文件夾
輸入Dos命令:Javac Hello.java
文件夾里會(huì)生成一個(gè)class文件
【注意事項(xiàng)】
每個(gè)單詞的大小寫(xiě)有嚴(yán)格要求胆萧,拼寫(xiě)順序不能出錯(cuò)
輸出中文可能會(huì)出現(xiàn)亂碼
文件名與類(lèi)名必須保持一致,并首字母大寫(xiě)
不能使用中文符號(hào)
5.輸入Dos命令:Java Hello**