- import java.util.*;
- class demo
- {
- public static void main(String []args)
- {
- Calendar c = Calendar.getInstance();
- c.set(2014,7,1);
- int day = c.get(Calendar.DAY_OF_MONTH);
- int mon = c.get(Calendar.MONTH);
- int count =0;
-
- while(!(day==1&&mon==8))
- {
- if(c.get(Calendar.DAY_OF_WEEK)==5||c.get(Calendar.DAY_OF_WEEK)==6)
- continue;
-
- c.add(Calendar.DAY_OF_MONTH,1);
- count++;
- }
- System.out.println(count);
- }
- }
复制代码
为什么我运行上面的计算一个月内除掉的工作六日,这个循环不起来呢?我试过了add方法在循环外面也没增加天数效果,为什么呢. |
|