1. Use code tags.
2. There are few errors in your given program.
3. Never throw exception from main(), avoid using it. Instead catch the exception.
4. You must look Lesson: Basic I/O