On Aug 18, 8:00 am, Nguyễn Đình Đoàn <[email protected]> wrote:
> Can't stop inputting data. Did anyone get the same trouble like me ?
> I tried with command line and JCreator, it's ok so this is error belongs to
> netbeans.
> I don't like using "\r\n" or "\n" because it won't work on different OS.
> Then I used "line.separator".
> The code I referred above:
>
> public static void main(String[] args) {
> Scanner scanner = new Scanner(System.in);
> scanner.useDelimiter(System.getProperty("line.separator"));
> System.out.println("Input:");
> String name = scanner.next();
>
>
>
> }
I have no problem with your code using Netbeans 6.7.1 and jdk 1.6. You
may try with nextLine() instead of next() method, and also close the
scanner after this line.
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---