|
|
![]() |
| Thread Tools | Search this Thread |
#1
| |||
| |||
Scanner problems (java) my problem is the following: The program will run until the user press "Enter" but indicated nothing. I thought something like this: Code: Scanner sc = new Scanner (System.in); String = into sc.next (); if (in == null) System.exit (0); (enter enter-pressure leads to a new line in the terminal window, but in the program hands "no".) If anyone has any solution to my problem, I would be very grateful! |
#2
| |||
| |||
Re: Scanner problems (java) Code: Scanner sc = new Scanner (System.in); String = into sc.nextLine (); if (in.equals ("")) System.exit (0); |
#3
| |||
| |||
Re: Scanner problems (java) Code: Scanner scanner input = new Scanner (System.in); while ((String input = scannerInput.nextLine ())! = "") ( ) |
![]() |
|
Tags: java |
Thread Tools | Search this Thread |
|
![]() | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Java barcode scanner | Rily | Software Development | 6 | 28-07-2010 10:33 AM |
Scanner & PrintStream Issue in Java | visioneye | Software Development | 3 | 21-07-2010 05:56 AM |
How to add parse in scanner in java? | MAGAR | Software Development | 5 | 02-03-2010 04:30 PM |
Scanner can't read in java | cyber-noob | Software Development | 3 | 14-11-2009 12:42 PM |
Problems with HP PSC 750 scanner | ameer123 | Hardware Peripherals | 2 | 07-10-2008 02:29 PM |