finallyの挙動

public class Test {
	public static void main(String[] args) throws Exception {
		String s = null;
		try {
			s.length();
		} finally {
			s.length();
		}
	}
}

↑こういうことをすると5行目と7行目で例外が発生するが、実際にthrowされるのは7行目だけ。

public class Test {
	public static void main(String[] args) throws Exception {
		String s = null;
		try {
			s.length();
		} finally {
			return;
		}
	}
}

↑5行目で例外が発生するが、実際は例外はthrowされず、単にreturn。