LogiQuest
Back to Inner Classes
9

What is the output of the following program?

public class Main {
    public static void main(String[] args) {
        int base = 10;
        class Adder { int add(int x) { return base + x; } }
        System.out.println(new Adder().add(5));
    }
}
Medium

Discussion (0)

  • No discussion yet. Ask a doubt or share a shortcut.

Log in to join the discussion.