What is the result of the following code execution?

public class Main {

    public static void main(String... args) {
        System.out.println("" + new Main().summ(3, 3));

    public int summ(int a, int b) {
        try {
            return a + b;
        } finally {
            if (a == b)
                return 0;            
Finally block is always executed. It overwrites the return value from the try block.
Java Quiz
Start Quiz

or Read more about Java Quiz

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback