Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

Share this Page URL
Help

Chapter 9. Composite Components > Packaging Composite Components in JARs - Pg. 382

382 Chapter 9 Composite Components 58. if (d < 1 || m < 1 || m > 12) { 59. return false; 60. } 61. if (m == 2) { 62. if (isLeapYear(y)) { 63. return d <= 29; 64. } else { 65. return d <= 28; 66. } 67. } else if (m == 4 || m == 6 || m == 9 || m == 11) { 68. return d <= 30; 69. } else { 70. return d <= 31; 71. } 72. } 73. private static boolean isLeapYear(int y) { 74. 75. return y % 4 == 0 && (y % 400 == 0 || y % 100 != 0); 76. } 77. }