Java 基礎 之開發工具Eclipse & 使用eclipse構建HelloWorld
eclipse很久不用了。現在個人工作中使用的是idea,這裏記錄下很久以前自己編寫的筆記,勿忘初❤
Eclipse的配置
切換爲java透視圖: window—>Perspective—>open Perspective—>other—>java
重置透視圖: window—>Perspective—>reset Perspective
Package Explorer :包資源管理器,用來管理項目的包
入門演示如何創建項目
file--->New--->Java Project
項目結構 :
jre :運行環境
src: 存放源碼
1 創建包 ,公司域名的倒置 www.baidu.com com.baidu.helloworld
com.qf.helloworld 小寫
2 創建類,類名HelloWorld
3 編寫代碼
4 運行 點擊run按鈕
配置Eclipse
1 修改字體大小 window-->preferences--->輸入font---->colors and fonts
--->basic--->text font
2 修改編碼 utf-8 window-->preferences--->
輸入 encoding--> workspace--> other utf-8
3 修改代碼提示 window-->preferences--->
輸入 assist --->java--editor> content assist
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ(@,
常用快捷鍵的介紹
常見模板代碼(代碼片段)
main—>主函數
sysout—>輸出語句
自定模板
window–>preferences–>java—>editor—>templates
添加模板
psvm
public static void main(String[] args){
${cursor}
}
ctrl+D:刪除一行
ctrl+shift+f:格式化代碼
ctrl+S:保存文件
ctrl+/:單行註釋
ctrl+/:取消單行註釋
ctrl+f11:運行
參考資料
可參考http://www.runoob.com/eclipse/eclipse-create-java-project.html 【來源菜鳥教程】