You do realise you have to give it a null line, which you do by entering the end-of-file character? On Windows® try ctrl-Z, on *nix try ctrl-D. If you don't give it an end-of-file, it always assumes it is at the start of a new line.
Try changing the != null test to the isEmpty() ,method. Remember the bang operator ! before (s. Using String#isEmpty() will stop if you use the enter key twice.
Beware: it only works in Java6+. Otherwise you can try .length() > 0