Java

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

VScode環境建置

JAVA JDK 下載安裝

JAVA有很多種版本,這邊直接提供我用的版本

直接安裝完後要新增環境變數→系統環境變數→新增
變數名稱:

JAVA_HOME

變數值:

C:Program Files/Java/jdk-XX<版本號>

安裝maven

直接下載壓縮檔

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

下載之後解壓縮並將apache-maven-3.8.8移動至以下路徑

C:/Program Files

接著將以下路徑加入至環境變數→使用者環境變數→Path

C:/Program Files/apache-maven-3.8.8/bin

JAVA 程式語言定位

主要是後端的程式語言,可以做Android APP的撰寫,或者是Web Application的Backend

JAVA 架構

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

JAVA 基本結構

第一個JAVA

JAVA Hello

新增一個專案資料夾,底下新增一個Hello.Java

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

接著打以下程式碼

public class Hello { public static void main(String[] args) { System.out.println("Hello, java!"); } }

開啟Terminal

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

輸入以下指令編譯java檔案

javac Hello.java

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

編譯完成後會多一個Hello.class的檔案
Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

執行java檔案

java Hello

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →
每次修改完成都需要編譯一次才可以做執行,JAVA並非編譯式語言,而是編譯與直譯的混和

JAVA 專案

Reference:https://www.tsnien.idv.tw/Java1_WebBook/chap1/1-2 Java 語言的特性.html,https://www.oracle.com/tw/developer/java-developers/