日历对象数组 [英] Array of calendar objects

查看:175
本文介绍了日历对象数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以创建日历对象的数组?

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆