我需要編寫一個程序,讓用戶輸入一次字符串日期(例如10/21),並將該字符串轉換爲整數。我想在分析之前需要分割?字符串輸入,解析,拆分
import java.util.Scanner;
public class ConvertDates {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Please input a date (mm/dd): ");
String k = input.next();
k = String.split("/");
int mm = Integer.parseInt(k);
int dd = Integer.parseInt(k);