lakmal padmakumara wrote:Please Explain me the difference of IOException and Exception.
Exception and IOException both are checked exceptions, but Exception class has an unchecked sub-class RuntimeException. So when you catch an IOException, then the compiler checks that there should be an IOException thrown in the associated try block. If there is a chance that IOException is thrown in the try block it is fine, otherwise you'll get a compilation error. The compiler only checks this for checked exceptions (as is clear from the name). This is why this check is not performed for Exception (although Exception class itself is checked, it has an unchecked sub-class so the check is not performed)
lakmal padmakumara wrote:And also when im using Exception im facing a problem .Beacuse a String can be a number also. So when i enter a number as my name it does not run the exception !! tell me a solution for that ! thanks ! (for name accepting only letters )
If you want to disallow numbers, then you'll have to manually check the string by applying a regular expression on it...