-1
一直說「不兼容的類型String []不能轉換爲字符串」無法在我的數組中輸入數據
我有什麼問題嗎?
public class TimeCard {
private int employeeNum;
private String[] clockInTimes = new String[14];
private String[] clockOutTimes = new String[14];
private float[] decimalClockIn = new float[14];
private float[] decimalClockOut = new float[14];
private float[] timeElapsed = new float[14];
public String getClockInTimes()
{ //im getting the error here
return clockInTimes;
}
public void setClockInTimes(String[] value)
{ //getting the error here
clockInTimes = value;
}
}
現在更新它不會讓我在數組中輸入一個字符串。
我試圖做這樣的:
public class TestTimeCard {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Scanner reader = new Scanner(System.in);
TimeCard josue = new TimeCard();
System.out.println("Enter Monday Clock In Times:");
josue.setClockInTimes(reader.next());
}
}
好的,謝謝!我修正了它,就像你說的那樣,它沒有顯示任何錯誤。 –
所以請標記爲答案。 –