Try   HackMD

【韩顺平讲Java】Chapter2 - Java概述


即使再小的帆也能遠航

參考自【零基础 快速学Java】韩顺平 零基础30天学会Java

tags: 韓順平講Java

  1. Java屬於解釋型語言 (相對於編譯型語言)
  2. 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 →
  3. 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.exe對字節碼文件進行執行,本質就是將.class裝載到JVM執行
  4. 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 →
  5. 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 →
  6. \r -> 迴車
public class CharChange{ public static void main(String[] args){ // 解讀 // 1. 輸出 韓順平教育 // 2. 表示回車,將光標移到開頭(韓) // 3. 繼續輸出 System.out.println("韓順平教育\r北京"); // 北京平教育 System.out.println("韓順平教育\r\n北京"); /* 韓順平教育 北京 */ } }
  1. 在控制台輸入tab鍵,可以實現命令自動補齊

文檔注釋

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 →

DOS命令

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 →

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 →


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 →

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 →

課堂練習

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 →

public class Test{ public static void main(String[] args){ System.out.println("書名\t作者\t價格\t銷量\n三國\t羅貫中\t120\t1000"); } }

本章作業

  1. 編寫hello, world程序
  2. 將個人基本信息打印到控制台輸出,每條訊息佔一行
  3. JDK, JRE, JVM 關係
    • JDK = JRE + java開發工具
    • JRE = JVM + 核心類庫(Java SE)
  4. 環境變量Path配置及其作用
    • 環境變量的作用是為了在dos的任意目錄,可以使用 java/javac命令
    • 先配置 JAVA_HOME = 指向 jdk 安裝的主目錄
    • 編輯path環境變量,增加 %JAVA_HOME%\bin
  5. Java編寫步驟
    • 編寫Java的源代碼
    • javac 編譯,得到對應的 .class 字節碼文件
    • java 運行,本質就是把 .class 加載到 jvm 運行
  6. Java編寫7個規範
    • 類、方法的注釋,使用javadoc的方式,即文檔注釋
    • 非 javadoc 的注釋,往往是對代碼的說明(給程序維護者),說明如何修改、注意事項
    • 使用tab -> 代碼右移, shift+tab -> 代碼左移
    • 運算符和 = 的兩邊,給空格,代碼看上去清楚
    • 源碼文件使用 utf-8 編碼
    • 行寬字符不要超過 80
    • 代碼編程風格有兩種,次行風格、行尾風格(推薦)
  7. 初學者易犯錯誤
    • 編譯或者運行時,找不到文件
    • 主類名和文件名不一致
    • 缺少;
    • 拼寫錯誤(半全形)