Can this method ever throw exception?

public static int getTest() {
    try {
        // arbitrary code here
    } finally {
        return 1;
If the finally block returns the value from a method or throws an exception, this behaviour always has more priority than behaviour of the corresponding try block. This method always returns 1.

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Keep exploring
Java quizzes
Sign Up Now
or Subscribe for future quizzes