By one line I mean at most 100 chars per line.
(I basically need this to keep the program alive. The main thread registers callback listeners that are run in separate threads. I just need the main one to hang forever and let the other threads do their work)
There are a few things you could do that would be better than hanging the initial thread forever:
otherThread.join(). This will cause the current thread you are running in to sleep until the other thread has finished executing.otherThread.setDaemon(false)and simply let your initial thread exit. This will set your new threads as user threads. Java will not shut down until the only threads running are daemon threads.