为了账号安全,请及时绑定邮箱和手机立即绑定

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

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

一部大神 2017-07-11 11:49:16
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);  } }
查看完整描述

1 回答

?
黄小凡

TA贡献69条经验 获得超36个赞

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

查看完整回答
1 反对 回复 2017-07-11
  • 1 回答
  • 0 关注
  • 1079 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信