Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
HI
i want to add the every year into the list . is this code is correct or wrong .
please give me a solution .. after that i want use this YearIist in some other class
public List<Integer> getYearList()
{
Calendar calendar=Calendar.getInstance();
List<Integer> years = new ArrayList<Integer>();
for(int num=0;num<=5;num++){
years.add(calendar.get(Calendar.YEAR)+num);
}
return years;