title: Parse int, double, and String from a String in Java
body: <p>I have to do an assignment in my Java class using the <code>Scanner</code> method to input an integer (number of items), a string (name of the item), and a double (cost of the item). We have to use <code>Scanner.nextLine()</code> and then parse from there.</p>
  
  <p>Example: </p>
  
  <pre><code>System.out.println("Please enter grocery item (# Item COST)");
  String input = kb.nextLine();         
  </code></pre>
  
  <p>The user would input something like: <code>3 Captain Crunch 3.5</code></p>
  
  <p>Output would be: <code>Captain Crunch #3 for $10.5</code></p>
  
  <p>The trouble I am having is parsing the int and double from the string, but also keeping the string value.</p>