やあ、
私はJavaが初めてで、このデータを配列(6行、3列)にプッシュする方法を見つけようとしていますか?
x1 John 6
x2 Smith 9
x3 Alex 7
y1 Peter 8
y2 Frank 9
y3 Andy 4
その後、数学的な計算を行うために最後の列から数値を取得します。
これは私のコードです...
public class Testing {
public static void main(String[] args) {
Employee eh = new Employee_hour();
Employee_hour [] eh_list = new Employee_hour[6];
eh_list[0] = new Employee_hour("x1", "John", 6);
eh_list[1] = new Employee_hour("x2", "Smith", 9);
eh_list[2] = new Employee_hour("x3", "Alex", 7);
eh_list[3] = new Employee_hour("y1", "Peter", 8);
eh_list[4] = new Employee_hour("y2", "Frank", 9);
eh_list[5] = new Employee_hour("y3", "Andy", 4);
print(eh_list);
}
private static void print(Employee_hour[] mass){
for (int i = 0; i < mass.length; i++) {
System.out.print(mass[i] + " ");
}
System.out.println();
}
}
しかし、私はこれを出力として取得しています...
testing.Employee_hour@1a752144 testing.Employee_hour@7fdb04ed testing.Employee_hour@420a52f testing.Employee_hour@7b3cb2c6 testing.Employee_hour@4dfd245f testing.Employee_hour@265f00f9
最後の列から数値を取得するにはどうすればよいですか?