press any other key to exit in java application code example Example: java pause program until key pressed System.in.read()