Question: I have following try catch:

```
try
{
   while(run)
   {
      try
      {
         // try something 
      }
      catch
      {
        // error catch 1
      }
   }
}
catch()
{
   // error catch 2
}
finally 
{
   // DONE
}

```

As per my under standing after throwing error in `error catch 1` it will again continue in while loop till `run` is true, which some times my code is not doing it goes in finally `DONE` code. I really don't know how it is happening?

Answer: 
The while loop will continue until:

* `run` is false, or
* an exception is thrown in the try block that is not caught in the catch block.

For example:

```
while(true) {
    try {
        throw new AnException();
    } catch (SomeOtherException e) {}
}

```

will exit immediately because you don't catch `AnException` in the catch block (assuming `SomeOtherException` is not a superclass of `AnException`).
> 
> As per my under standing after throwing error in error catch 1 it will again continue in while loop till run is true
> 
> 
> 

If you **throw** any `Throwable` from `catch1` , it goes to the next enclosing `catch` which can handle that type of `Throwable`. In that case the loop breaks. If there are no other `catch` which can catch that type of `Throwable` , then `finally` will execute and the control goes to the calling method.