I am just trying to read integer, double , string values from keyboard. it just working fine for integer and double. but when it comes to string, it was throwing a Input Mismatch Exception, so i cant able to read string from keyboard.
import java.util.Scanner;
import java.util.*;
public class Solution {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int i = scan.nextInt();
double d= scan.nextInt();
String s=scan.nextLine();
// Write your code here.
System.out.println("String: " + s);
System.out.println("Double: " + d);
System.out.println("Int: " + i);
}
}