how can my application then work when some exception is thrown , wont the application terminate or give some error.
That depends on what the application is doing. In the example code, the value of "x" isn't used for anything, so it doesn't matter than an exception was thrown during calculating it. Generally, a catch block either needs to put things into a state where the application can keep running, or it needs to re-throw the exception (or return an error code) for the calling method to handle.