【韩顺平讲Java】Chapter2 - Java概述
即使再小的帆也能遠航
參考自【零基础 快速学Java】韩顺平 零基础30天学会Java
- Java屬於解釋型語言 (相對於編譯型語言)
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 →
- 通過運行工具的java.exe對字節碼文件進行執行,本質就是將.class裝載到JVM執行
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 →
\r
-> 迴車
- 在控制台輸入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 →
本章作業
- 編寫hello, world程序
- 將個人基本信息打印到控制台輸出,每條訊息佔一行
- JDK, JRE, JVM 關係
- JDK = JRE + java開發工具
- JRE = JVM + 核心類庫(Java SE)
- 環境變量Path配置及其作用
- 環境變量的作用是為了在dos的任意目錄,可以使用 java/javac命令
- 先配置
JAVA_HOME
= 指向 jdk 安裝的主目錄
- 編輯path環境變量,增加
%JAVA_HOME%\bin
- Java編寫步驟
- 編寫Java的源代碼
- javac 編譯,得到對應的 .class 字節碼文件
- java 運行,本質就是把 .class 加載到 jvm 運行
- Java編寫7個規範
- 類、方法的注釋,使用javadoc的方式,即文檔注釋
- 非 javadoc 的注釋,往往是對代碼的說明(給程序維護者),說明如何修改、注意事項
- 使用tab –-> 代碼右移, shift+tab –-> 代碼左移
- 運算符和 = 的兩邊,給空格,代碼看上去清楚
- 源碼文件使用 utf-8 編碼
- 行寬字符不要超過 80
- 代碼編程風格有兩種,次行風格、行尾風格(推薦)
- 初學者易犯錯誤
- 編譯或者運行時,找不到文件
- 主類名和文件名不一致
- 缺少
;
- 拼寫錯誤(半全形…)