Access inner class from outside : Anonymous class « Class « Java

Access inner class from outside


public class Main {
    public static void main(String[] args) {
        Outer outer = new Outer(); Inner().hello();
class Outer {
    public class Inner {
        public void hello(){
          System.out.println("Hello from Inner()");


Related examples in the same category example of a simple anonymous class
2.Tick Tock with an Anonymous Class
3.Anonymous inner class
4.This program demonstrates anonymous inner classes