import java.util.*;
public class Repeat { public static void main(String[] args) { String sentence=" Testing the speed of your comp"; int count=1; Calendar start=Calendar.getInstance(); int startMinute=start.get(Calendar.MINUTE); int startSecond=start.get(Calendar.SECOND); start.roll(Calendar.MINUTE,true); int nextMinute=start.get(Calendar.MINUTE); int nextSecond=start.get(Calendar.SECOND); while(count<1000000){ System.out.println(sentence); GregorianCalendar now=new GregorianCalendar(); if(now.get(Calendar.MINUTE)>=nextMinute) if(now.get(Calendar.SECOND)>=nextSecond) break; count++; } System.out.println("\n I have wrote it"+count+"times"); } }
引入了util包,为什么还不能认出方法calendar()?
[此贴子已经被作者于2005-10-27 12:06:34编辑过]