Although @amit already gave very good answer I just want to add something.
So instead of throws we can use a try-catch block to catch the exception?
I think that this part of your question was not answered. Actually you are asking whether you should define methods that are "transparent" for exceptions or catch exceptions thrown within the method.
The answer is that it depends on your application.
Generally there are 2 cases when you want to catch exception into the method.
- you have something to do with the exception, so your flow depends on the fact that the exception was thrown. For example if you are reading from file and IO error happens you are trying to read from the file again.
You do not want to expose the exceptions thrown on specific layer of your application to higher level layers. In this case you will probably wrap your code with try block and wrap thrown exception with other level exception:
try {
// some code
} catch(IOException e) {
throw new ApplicationLevelException(e);
}
In most other cases you will probably want to be transparent for exceptions and catch all exception in one single point that knows what to do with them. For example shows customer facing error message.