为什么它不读取字符串,但读取双精度和整数值。

时间:2018-11-06 07:41:31

标签: java string

import java.util.Scanner;

public class Solution {

    public static void main(String[] args)
    {
     Scanner scan = new Scanner(System.in);
        int i = scan.nextInt();
        double d=scan.nextDouble();
        String str= scan.nextLine();
        System.out.println("String: " +str);
        System.out.println("Double: " +d);
        System.out.println("Int: " +i);
    }
}

0 个答案:

没有答案