I think the problems you're having are with:

          System.in.skip(1);            //remove nl

The argument is a long, not an int, so 1L would probably be better.
But the documentation for anInputStream.skip(long n) says:

      Skips over and discards n bytes of data from this input
      stream. The skip method may, for a variety of reasons, end up
      skipping over some smaller number of bytes, possibly 0. The
      actual number of bytes skipped is returned.

So you should test the return value of skip() and you should catch
IOException as well.

Ask your instructor to provide you a stack trace along with the next
bug report.

-- 
Geoffrey S. Knauth                           http://world.std.com/~gsk

Reply via email to