java中编译编写程序,判断给定的某个年份是否是闰年。出错
importjava.util.Scanner;classBissextile{publicstaticvoidmain(String[]arge){System.out...
import java.util.Scanner;class Bissextile{ public static void main(String[] arge){ System.out.print("请输入年份"); int year; //定义输入的年份名字为“year” Scanner scanner = new Scanner(System.in); year = scanner.nextInt(); if (year<0||year>3000){ System.out.println("年份有误,程序退出!"); System.exit(0); } if ((year%4==0)&&(year%100!=0)||(year%400==0)) System.out.println(year+" is bissextile"); else System.out.println(year+" is not bissextile "); }}编译出错,显示找不到或无法加载此类
展开
2个回答
展开全部
import java.util.Scanner;
public class Bissextile {
public static void main(String[] arge) {
System.out.print("请输入年份");
int year; // 定义输入的年份名字为“year”
Scanner scanner = new Scanner(System.in);
year = scanner.nextInt();
if (year < 0 || year > 3000) {
System.out.println("年份有误,程序退出!");
System.exit(0);
}
if ((year % 4 == 0) && (year % 100 != 0) || (year % 400 == 0))
System.out.println(year + " is bissextile");
else
System.out.println(year + " is not bissextile ");
}
}
展开全部
去掉里面的类
追问
去掉带下划线的那类吗?还是不行
追答
import java.util.Scanner;
public class Bissextile{
public static void main(String[] arge){
System.out.print("请输入年份");
int year; //定义输入的年份名字为“year”
Scanner scanner = new Scanner(System.in);
year = scanner.nextInt();
if (year3000){
System.out.println("年份有误,程序退出!");
System.exit(0);
}
if ((year%4==0)&&(year%100!=0)||(year%400==0))
System.out.println(year+" is bissextile");
else
System.out.println(year+" is not bissextile ");
}
}
用这个,保证对。。。。。
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询