Java每日一题20161122

20161121问题解析请点击今日问题下方的“【Java每日一题】20161122”查看(问题解析在公众号首发,公众号ID:weknow619)

package Nov2016;

import java.util.ArrayList;
import java.util.Iterator;

public class Ques1122 {
    
    public static void main(String[] args) {
        ArrayList students = new ArrayList();

        students.add(new Student("stu01", 01));
        students.add(new Student("stu02", 02));
        students.add(new Student("stu03", 03));
        students.add(new Student("stu04", 04));

        Iterator it = students.iterator();

        while (it.hasNext()){
            System.out.println(it.next().name);
            System.out.println(it.next().num);
        }
    }
}

class Student{
    String name;
    int num;
    
    Student(String name, int num){
        this.name = name;
        this.num = num;
    }
}

今日问题:
请问主程序输出结果是什么?(点击以下“【Java每日一题】20161122”查看20161121问题解析)

你可能感兴趣的:(Java每日一题20161122)