What will happen after compilation and execution of the following program?

class Main {
    public void method() {
        static class One {
            public One() {
                System.out.println("From one");

    public static void main(String... args) {
        new Main().method();
Local classes can't have modifiers public, private, protected or static.

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback