public class ExceptionTest { public Test2333 txt(){ Test2333 test = new Test2333(); try { test.setX(1); test.setY(1); return test; }finally{ test.setY(10); } } public class Test2333{ int x; int y; public int getX() { return x; } public void setX(int x) { this.x = x; } public int getY() { return y; } public void setY(int y) { this.y = y; } } public static void main(String[] args){ ExceptionTest exceptionTest = new ExceptionTest(); Test2333 test = exceptionTest.txt(); System.out.println(test.getX()+"~~~"+test.getY()); } }