靜態內部類 呼叫

干饭达人GoodLucy發表於2024-08-10
package com.fh.hello1;

public class T {
    public static void main(String[] args) {
        new A().aHello();
        new A.B().bHello();
        new A.B.C().cHello();
    }

    static class A {
        public void aHello() {
            System.out.println("A hello");
        }

        static class B {
            public void bHello() {
                System.out.println("B hello");
            }

            static class C {
                public void cHello() {
                    System.out.println("C hello");
                }
            }
        }
    }
}

相關文章