首页 > 代码库 > 【Java每日一题】20161122

【Java每日一题】20161122

package Nov2016;

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

public class Ques1122 {    

  public static void main(String[] args){
   ArrayList<Student> students = new ArrayList<Student>();

   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<Student> 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,【Java每日一题】20161122 

技术分享

 

【Java每日一题】20161122