LogiQuest
Back to Inner Classes
8

What is the output of the following program?

public class Main {
    interface Greeter { String hi(); }
    public static void main(String[] args) {
        Greeter g = new Greeter() {
            public String hi() { return "hello"; }
        };
        System.out.println(g.hi());
    }
}
Easy

Discussion (0)

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

Log in to join the discussion.