You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
NetBeans IDE >> [File] >> New Project... >> Categories: Java / Projects: Java Application >> [Next]
填寫 Project Name 和 Create Main Class >> [Finish]
開啟 {{Project Name}}.java, 撰寫程式碼。第一支程式,簡單的印出字串。在 main 函式裡,打上 System.out.println("Hello, Java!");
試著跑跑看,看結果 Run Project (F6)
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */packageio.github.shyangs.helloworldprinter;
/** * * @author Java */publicclassHelloWorldPrinter {
/** * @param args the command line arguments */publicstaticvoidmain(String[] args) {
// TODO code application logic hereSystem.out.println("Hello, Java!");
}
}
使用 Eclipse
NetBeans IDE >> [File] >> New >> Java Project >> 填寫 Project name >> [Finish]
在 Source Folder (src) 上點右鍵 >> New >> Class >> 填寫 Package >> 勾選 public static void main(String[] args) >> [Finish]
開啟 {{Project Name}}.java, 撰寫程式碼。第一支程式,簡單的印出字串。在 main 函式裡,打上 System.out.println("Hello, Java!");
使用 cmd
C:\Temp\HelloWorld.java
,其內容為:cd C:\Temp
javac
命令來編譯,在此命令為javac HelloWorld.java
,在 HelloWorld.java 同資料夾裡編譯出了 HelloWorld.class ,在此路徑為C:\Temp\HelloWorld.class
java
命令來執行Class檔,在此命令為java HelloWorld
,將看到輸出 ‵Hello World!‵使用 NetBeans
System.out.println("Hello, Java!");
使用 Eclipse
public static void main(String[] args)
>> [Finish]System.out.println("Hello, Java!");
The text was updated successfully, but these errors were encountered: