I have a problem with ArrayList variables printing out to output. What am I doing wrong?
ArrayList al = new ArrayList();
for (int i = 0; i < 10; i++) {
al.add(new Calc(i, tan.ro, tan.stro));
}
for (int i = 1; i < 10; i++) {
Object ol = al.get(i);
Calc temp = (Calc) ol;
System.out.println("Calculations = "+ temp.getMass());
System.out.println(al.get(i));
My output:
Calculation = 5.0
App.Calc@15db9742
Calculation = 40.0
App.Calc@6d06d69c
I want to change that App.Calc@6d06d69c to correct value of i