java中匿名内部类的匿名构造函数是怎么用的
下面的例子说明匿名内部类的匿名构造函数的用法 
例2.7.2_0
interface FigureMark_to_win {
    void whoAmI();
}
public class Test {
    public static void main(String[] args) {
        FigureMark_to_win ttm = new FigureMark_to_win() {
            private String msg = "三角形";
          
            {//马克-to-win: 匿名构造函数
                msg = "长方形";
            }
            public void whoAmI() {
                System.out.println(msg);
            }
        };
        ttm.whoAmI();
    }
}
result is:
长方形
更多内容请见原文,文章转载自:https://blog.csdn.net/qq_44591615/article/details/109276257
原文:https://www.cnblogs.com/shituxingzhe1949/p/14392135.html