public class Exercise7_3 { public static void main(String[] args) { int year = (int)( Math.random() * 10000 );
System.out.print( year + "年" ); if( ( year%4==0 && year%100!=0 ) || year%400==0 ) { System.out.println( "是闰年。" ); } else { System.out.println( "不是闰年。" ); } }
原文:http://www.cnblogs.com/bianxiaoyan/p/5212602.html