i have a problem with my Java program..
i need to input 2 Strings and 1 char using a Scanner object named console..
so i use
now, it works fine the first time, but when I want to input again, it skips First and asks for Middle right away (especially when First or Last has blank spaces).Code:Scanner console = new Scanner(System.in); ... String First = console.nextLine(); char Middle = console.next().charAt(0); String Last = console.nextLine();
i read about clearing input buffers in C when I had a similar problem, but how do I do it in Java?




Reply With Quote