public class NumberOfYears {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Enter the number of minutes as a whole number: ");
double minutes = input.nextInt();
int numberOfDays = minutes / 24 * 60;
int numberOfYears = numberOfDays / 365;
int remainingDays = numberOfDays / 365;
// Display results
System.out.println(minutes + " minutes is approximately " +
numberOfYears + " years and " remainingDays + " days remaining");
}
}
NumberOfYears.java:14:预期错误:')' numberOfYears +“年和”剩余天数+“剩余天数”); ^ NumberOfYears.java:14:错误:不是语句 numberOfYears +“年和”剩余天数+“剩余天数”); ^ NumberOfYears.java:14:错误:';'预期 numberOfYears +“年和”剩余天数+“剩余天数”); ^ 3个错误
答案 0 :(得分:1)
进行连接时,您缺少+
符号
System.out.println(minutes + " minutes is approximately " + numberOfYears + " years and " + remainingDays + " days remaining");