OneCompiler

Java program to take String as a input from user which follows to the integer user input.

221

import java.util.*;

public class Solution {

public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    int n=scan.nextInt();
    double dd=scan.nextDouble();
    scan.nextLine();
    /*scan.nextLine()
    It is used to avoid the string str as a blank or null 
    because without this string str will be printed as a 
    blank string,you can check it after commenting this line
    scan.nextLine();
    */
    String str=scan.nextLine();
    //print output
    System.out.println("String:"+str);
    System.out.println("Double:"+dd);
    System.out.println("Integer:"+n);
}

}