-5
我想設置對象e1的字符串[],但我不斷收到illegal start of expression
錯誤。我是Java的新手,我完全不知道什麼是錯的。任何幫助表示讚賞。如何解決Java中非法表達式的啓動問題?
public class Employeetest {
public static void main(String[] args) {
Employee e1 = new Employee();
e1.person ={"","","","",""};
e1.printInfo();
}
}
public class Employee {
String[] person ={"","","","",""};
public void printInfo() {
System.out.println("Name:" + person[0]);
System.out.println("Gender:" + person[1]);
System.out.println("Job Title:" + person[2]);
System.out.println("Organization:" + person[3]);
System.out.println("Birthday:" + person[4]);
}
}
歡迎來到Stack Overflow!你有什麼具體的錯誤?你覺得他們是什麼意思?到目前爲止你做了什麼來解決它?您提供的細節越多,我們就可以提供更好的幫助。 – templatetypedef 2015-01-21 00:01:34
[Declare array in Java?]的可能重複(http://stackoverflow.com/questions/1200621/declare-array-in-java) – 2015-01-21 00:02:26