0

I wrote some code off my Pseudo post and it compiles, but after entering the item name and cost the first time, then the name again it throws an error with input mis match exception. I'm not sure why.

import java.util.Scanner;


public class NewAssignment
{

    public static void main(String args[]){
  • Please post your stack trace, also mind your indentation: the start of your code isn't rendered as code but as plain text :) – Turtle Oct 13 '17 at 14:42
  • Just to be sure: are you entering the name and the price **on the same line** ? If yes your problem is quite clear: the second time you input the name, it is at the `nextDouble` call, and the input is therefore of the wrong type – Turtle Oct 13 '17 at 14:44

1 Answers1

0

use names[count] = keyboard.next(); instead od names[count] = keyboard.nextLine(); it will work.