Best writers. Best papers. Let professionals take care of your academic papers

Order a similar paper and get 15% discount on your first order with us
Use the following coupon "FIRST15"

public class BasicInput

I’ve tried to run this code:

public class BasicInput {
   public static void main(String[] args) {
      Scanner scnr = new Scanner(;
      int userInt = 0;
      double userDouble = 0.0;
      char ch;
      String s;
      System.out.print(“Enter integer: “);
      userInt = scnr.nextInt();
      System.out.print(“Enter double: “);
      userDouble = scnr.nextDouble();
      System.out.print(“Enter character: “);
      ch =;
      System.out.print(“Enter string: “);
      s =;
      System.out.println(userInt+” “+userDouble+” “+ch+” “+s);
      System.out.println(s+” “+ch+” “+userDouble+” “+userInt);
      System.out.println(userDouble+” cast to an integer is “+(int)userDouble);

My values are:

Enter integer: 99
Enter double: 3.77
Enter character: z
Enter string: Howdy
99 3.77 z Howdy

The result I get is:

Enter integer: Exception in thread “main” java.util.NoSuchElementException
at java.util.Scanner.throwFor(
at java.util.Scanner.nextInt(
at java.util.Scanner.nextInt(
at BasicInput.main(

"Looking for a Similar Assignment? Order now and Get 10% Discount! Use Code "Newclient"