Как вы используете метод с кодом внутри в?
public void initialiseVariables(){
name=timestamp.substring(0, 20);
// numofdep = timestamp.substring(35, 37);
//noofovertime = timestamp.substring(38, 40);
if(timestamp.charAt(20)=='C')
city=true;
if(timestamp.charAt(21)=='U')
union=true;
identificationnumber=Integer.parseInt(timestamp.substring(22,26));//to get an integer from a string use the integer.parseint
numofdep = Integer.parseInt(timestamp.substring(35, 37));
noofovertime = Integer.parseInt(timestamp.substring(38, 40));
hoursworked=Integer.parseInt(timestamp.substring(27,29));
hourlyrate = Double.parseDouble( timestamp.substring(30, 34));
}
Я не понимаю, что вы вкладываете в конструктор. Кроме того, как вы определяете, что вы положили в параметры? как этот конструктор написал мой друг.
Employees(){
this.timestamp=timestamp;
initialiseVariables();
}
Итак, как мне использовать, например, строку,
name=timestamp.substring(0, 20);
в моем основном классе?