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();
    }        
}
Explanation
Local classes can't have modifiers public, private, protected or static.
Java
Java Quiz
Start Quiz

or Read more about Java Quiz

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback