当前位置: 技术问答>java相关
一个数组问题,请指教.
来源: 互联网 发布时间:2015-03-13
本文导语: //http://java.sun.com/docs/books/tutorial/reflect/array/newInstance.html //SampleCreateArray.java import java.lang.reflect.*; public class LeapYear { // // public void LeapYear(){ } public boolean Leap(int year){ boolean value; if ((year%4)!=0) value=false; els...
//http://java.sun.com/docs/books/tutorial/reflect/array/newInstance.html
//SampleCreateArray.java
import java.lang.reflect.*;
public class LeapYear
{
//
//
public void LeapYear(){
}
public boolean Leap(int year){
boolean value;
if ((year%4)!=0)
value=false;
else {
if ((year%100)!=0)
value=true;
else{
if ((year%400)!=0)
value=false;
else
value=true;
}
}
return value;
}
public static void main(String args[]) {
boolean hResult;
int[] nYear = {1998, 1999, 2000, 2001};
int[] nOtherYears = (int[]) OtherYears(nYear);
//nYear
LeapYear hYear = new LeapYear();
for (int i=0;i
//SampleCreateArray.java
import java.lang.reflect.*;
public class LeapYear
{
//
//
public void LeapYear(){
}
public boolean Leap(int year){
boolean value;
if ((year%4)!=0)
value=false;
else {
if ((year%100)!=0)
value=true;
else{
if ((year%400)!=0)
value=false;
else
value=true;
}
}
return value;
}
public static void main(String args[]) {
boolean hResult;
int[] nYear = {1998, 1999, 2000, 2001};
int[] nOtherYears = (int[]) OtherYears(nYear);
//nYear
LeapYear hYear = new LeapYear();
for (int i=0;i