我一直在使用 eclipse,每当我尝试更改存储在字符数组中的值时,它都会引发错误。代码:
import java.util.Scanner;
public class test {
public static void main(String args[]) {
char monstername[] = {'e', 'v', 'i', 'l'};
String monster = new String(monstername);
System.out.println("Hello!");
System.out.println("You are attacked by a " + monster);
monstername[] = {'t', 'v', 'i', 'l'};
System.out.println("You are attacked by a " + monster);
}
}
我尝试更新库,但没有奏效。