
- Eclipse 教程
- Eclipse - 首頁
- Eclipse - 概述
- Eclipse - 安裝
- Eclipse - 探索視窗
- Eclipse - 探索選單
- Eclipse - 探索檢視
- Eclipse - 透檢視
- Eclipse - 工作區
- Eclipse - 建立Java專案
- Eclipse - 建立Java包
- Eclipse - 建立Java類
- Eclipse - 建立Java介面
- Eclipse - 建立XML檔案
- Eclipse - Java構建路徑
- Eclipse - 執行配置
- Eclipse - 執行程式
- Eclipse - 建立Jar檔案
- Eclipse - 關閉專案
- Eclipse - 重新開啟專案
- Eclipse - 構建專案
- Eclipse - 除錯配置
- Eclipse - 除錯程式
- Eclipse - 首選項
- Eclipse - 內容輔助
- Eclipse - 快速修復
- Eclipse - 懸停幫助
- Eclipse - 搜尋選單
- Eclipse - 導航
- Eclipse - 重構
- Eclipse - 新增書籤
- Eclipse - 任務管理
- Eclipse - 安裝外掛
- Eclipse - 程式碼模板
- Eclipse - 快捷鍵
- Eclipse - 重啟選項
- Eclipse - 提示與技巧
- Eclipse - Web瀏覽器
- Eclipse 有用資源
- Eclipse - 快速指南
- Eclipse - 有用資源
- Eclipse - 討論
Eclipse - 快速修復
使用快速修復
當您在 Eclipse 編輯器中輸入字元時,它會分析文件內容以查詢潛在的錯誤和警告。Java 編輯器使用 Java 語法檢測程式碼中的錯誤。當它發現錯誤或警告時,它會:
- 使用紅色波浪線突出顯示錯誤。
- 使用黃色波浪線突出顯示警告。
- 在
問題
檢視中顯示錯誤和警告。 - 在垂直標尺上新增帶有警告符號或錯誤符號的燈泡。
快速修復對話方塊提供可能的更正列表。可以透過以下方式呼叫快速修復對話方塊:
- 將滑鼠指標放在波浪線上。
- 單擊燈泡。
- 將游標放在突出顯示的文字中,然後從“編輯”選單中選擇“快速修復”,或單擊快捷鍵
Ctrl + 1
。

在上圖中,getId 被突出顯示,因為 Person 類沒有名為 getId() 的方法。選擇在 'Person' 型別中建立方法 'getId()'
將導致 getId() 方法新增到 Person 類中。
也可以透過右鍵單擊“問題”檢視中的錯誤項並選擇“快速修復”選單項來顯示快速修復對話方塊。
廣告