package J20250715.homework;

import java.util.Arrays;
import java.util.Scanner;

/**
 * @author WanJl
 * @version 1.0
 * @title Demo04
 * @description split(String regex) 方法
 * @create 2025/7/15
 */
public class Demo04 {
    public static void main(String[] args) {
        /*
        String s="hello world";
        String[] s1 = s.split("o");
        for (int i = 0; i < s1.length; i++) {
            System.out.println(s1[i]);
        }

         */

        System.out.println("请输入一段字符串....");
        //创建Scanner对象
        Scanner sc=new Scanner(System.in);
        String s = sc.nextLine();
        String[] strings = s.split(",");
        //创建Student对象
        Student student=new Student();
        student.setName(strings[0]);
        String sAge = strings[1];
        //Integer是int类型对应的引用数据类型
        //Integer.parseInt(字符串); 作用就是把字符串类型的数字转换为int类型的数字
        int age = Integer.parseInt(sAge);
        student.setAge(age);

        System.out.println(student.getName()+"..."+student.getAge());
    }
}
