题解 | #出生日期输入输出#
出生日期输入输出
http://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 birthDate = in.nextLine();
System.out.println("year=" + birthDate.substring(0,4));//substring是关键
System.out.println("month=" + birthDate.substring(4,6));
System.out.println("date=" + birthDate.substring(6,8));
}
}