我需要帮助这个java.我创建了一个灯泡ArrayList,我试图用另一个灯泡替换特定索引的灯泡.因此,使用以下标题,我该如何处理?
public void replaceBulb(int index, Bulbs theBulb) {
}
Run Code Online (Sandbox Code Playgroud) 我有一个int变量,我想创建一个String返回该int变量的方法,我该怎么做呢?以下示例...并设置getAge()方法在年龄为18时返回"年轻",在年龄为30时返回"年龄".
private int age;
public String getAge() {
}
Run Code Online (Sandbox Code Playgroud)