题解 | #出生日期输入输出#
出生日期输入输出
https://www.nowcoder.com/practice/4a4a9dd1edb6453ba4a0432319200743
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); String brithDate = in.nextLine(); System.out.println("year=" + brithDate.substring(0, 4)); System.out.println("month=" + brithDate.substring(4, 6)); System.out.println("date=" + brithDate.substring(6, 8)); } }
看不懂的话 建议学一下substring的用法