這是我想將類實例:無法實例使用參數的構造函數的對象的Java
public class GoogleSheetsAPI {
String spreadsheetId;
Sheets service;
String credentialsFile;
public void GoogleSheetsAPI() {
}
public void GoogleSheetsAPI(String spreadsheetId, String credentialsFile) throws Exception {
this.spreadsheetId = spreadsheetId;
this.credentialsFile = credentialsFile;
service = getSheetsService();
}
}
這是我正在創建該類的對象GoogleSheetsAPI
GoogleSheetsAPI googleSheetsAPI = new GoogleSheetsAPI(spreadsheetId, credentiialsFile);
我沒有看到這裏的任何參數代碼;你明白這個詞的意思嗎?已移除標記。 –
@Abhijit你叫什麼** spreadsheetId,credentiialsFile **? – Rameshwar
形式參數。 https://chortle.ccsu.edu/java5/Notes/chap34A/ch34A_3.html –