日历对象数组 [英] Array of calendar objects
问题描述
可以创建日历对象的数组?
Can one create an array of calendar objects?
如果是的,一个人如何做到这一点?这code无疑给误差
If yes, how does one do so? This code surely gives error
Calendar cal[length];
//loop for initialising all the objects in cal[] array
如果没有,什么别的办法没有获取日历对象N是多少?
我需要这个重复报警,设置在不同的时间。
If no, what other way is there for getting "n" number of calendar objects? I need this for a repeating alarm, set at different times.
推荐答案
您总是可以做日历[] = CAL新的日历[长度];
您可以使用ArrayList,也如:
You can use an ArrayList, too, such as:
列表<日历和GT;名单=新的ArrayList<日历和GT;();
然后是方便了很多方法,如添加(日历日历);
Then there's a lot of convenience methods, such as add(Calendar calendar);
然后:
您可以使用的for(int x = 0; X<则为list.size(); X ++)
或为(日历CAL:列表)
这是有效的为阵,太。里面为你使用 getCalendar()
或新的GregorianCalendar()
或任何日历
你所需要的。
This is valid for the array, too. Inside the for you use getCalendar()
or new GregorianCalendar()
or whatever Calendar
you need.
这篇关于日历对象数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!