哪位大神能帮我看看哪里出问题了

package work;
//编写ControlStrcutureTest类,为该类增加一个函数checkLeapYear,
//函数参数为整数年份,返回值为true/false,该函数用于判断某年份是否闰年
//,在main函数中,分别用 220, 618, 960, 1271, 1368, 1644, 1912, 1949, 2000,
//2017, 2020等年份进行测试。闰年判断规则如下:
//①能被4整除且不能被100整除的为闰年。
//②能被400整除的是闰年。
public class ControlStrcutureTest {
 public static boolean checkLeapYear(int a)
 {
  boolean is = false;
  if(a%4 == 0 && a%100 != 0 || a%400 == 0)
   is = ture;
  else
   ;
  return is;
 }
 public static void main(String[] args){
  System.out.println("hello world");
  ControlStrcutureTest ok = new ControlStructureTest();
  checkLeapYear(100);
  System.out.println(is);
 }
}


一部大神
浏览 1080回答 1
1回答

黄小凡

public class ControlStrcutureTest {  public static boolean checkLeapYear(int a)  {   boolean is = false;   if(a%4 == 0 && a%100 != 0 || a%400 == 0)    is = true;   return is;  }  public static void main(String[] args){   boolean isLeap = checkLeapYear(2000);   System.out.println(isLeap);  } }你这写的也太乱了,而且单词也拼错了 ,true,不是ture
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java