title: How to store a value in variable as a double from user input?
body: <p>I've only just started learning programming in Java and I cannot figure out how to store a value from user input as a double.</p>
  <p>Here's my code:</p>
  <pre><code>    package FirstProject;
      
         import java.util.Scanner;
      
         public class TripPlanner {
             
             public static void main () {
             Scanner console = new Scanner(System.in);
             System.out.print(&quot;How many &quot; + currencySymbol + &quot; are there in 1 USD? &quot;);
             double conversion = console.nextDouble();
             }
         }
  </code></pre>
  <p>I don't understand why when I enter, for example 19.5, it gives me exception error. My understanding is that I defined the conversion variable as double (double conversion) and I expect the user to enter a double (console.nextDouble();). It's fundamental but coming from Python I can't understand what I'm doing wrong.</p>