数组列表变量打印

时间:2016-10-11 13:12:22

标签: java arraylist

我有 ArrayList 变量打印输出的问题。我做错了什么?

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));

我的输出:

Calculation = 5.0
App.Calc@15db9742
Calculation = 40.0
App.Calc@6d06d69c

我想将App.Calc@6d06d69c更改为正确值i

0 个答案:

没有答案