最后一行中的字符串不给ans

问题描述

package userInput;
import java.util.Scanner;
public class ScannerUserInput {
    public static void main(String[] args) {
        Scanner sc = new Scanner(system.in);
        String name = sc.next();
        int rollNo = sc.nextInt();
        sc.next();
        String fieldOfInterest = sc.nextLine();
        System.out.println("hey,my name is " +name );
        System.out.println("my roll no. is " +rollNo);
        //i dont kNow why my code is not working second input of string is not giving me the output
        System.out.println("my field of interest are " +fieldOfInterest);
    }
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)