Want to improve this question? Add details and clarify the problem by editing this post.
开发者_运维技巧Closed 6 years ago.
Improve this questionwhy we use 'Throws IOException' in java File handling. i mean what is the purpose of using these two words in File handling?? Please help...
You are probably referring to checked exceptions. They are used to indicate that a method could potentially throw one of the listed exceptions so that the callers need to explicitly catch them or be marked with the same exceptions list.
The throws word means that the code could enter an error state, the IOExeption word describes the error state.
This means that you will have to put any method that throws IOExcepion into a try ... catch block where you can write code to make your program respond to the error state appropriately.
精彩评论