JAVA读入一行空格隔开的数据

来源:互联网 发布:爱尚淘宝客程序源码 编辑:程序博客网 时间:2024/05/05 23:21

直接上干货:

import java.util.Scanner;public class Test {    public static void main(String[] args) {        Scanner sc = new Scanner(System.in);        String s = sc.nextLine();        String ss[] = s.split(" ");        for (String x : ss) {            System.out.println(x);        }    }}
0 0
原创粉丝点击