Does exception handling rollback actions done before the exception occurred?

Viewed 4182

Imagine I have a method like this

void myMethod(MyThing t) throws MyException {
   t.foo = "bar";
   if (t.condition()) { 
      throw new MyException();
   }
}

If the exception is triggered, does the value of t.foo revert to whatever it was previously? Or does it keep the "bar" value?

4 Answers
Related