解题思路: 将输入的月日创建LocalDate对象,调用getDayOfYear()方法输出即可
注意事项:
参考代码:
import java.util.Scanner;
import java.time.LocalDate;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int month = scanner.nextInt();
int day = scanner.nextInt();
LocalDate localDate = LocalDate.of(2019, month, day);
int dayOfYear = localDate.getDayOfYear(); //一年的第几天
System.out.println(dayOfYear);
}
}
0.0分
0 人评分
C语言训练-斐波纳契数列 (C语言代码)浏览:1270 |
WU-蓝桥杯算法提高VIP-交换Easy (C++代码)浏览:1186 |
Wu-求圆的面积 (C++代码)浏览:1994 |
WU-小九九 (C++代码)浏览:1713 |
C语言程序设计教程(第三版)课后习题8.8 (C语言代码)浏览:895 |
P1000 (C语言代码)浏览:911 |
1012题解浏览:938 |
A+B for Input-Output Practice (III) (C语言代码)浏览:594 |
1035 题解浏览:875 |
Pascal三角 (C语言代码)浏览:707 |