main方法原来只要放在public static类中就能跑,涨知识了

 

接口中可以装在嵌套类对象。

public interface ClassInterface {
    void howdy();
    class Test implements ClassInterface {
        public void howdy() {
            System.out.println("Howdy!");
        }
        public static void main(String[] args) {
            new Test().howdy();
        }
    }
}

 

posted @ 2017-08-17 14:09  guodaxia  阅读(191)  评论(0编辑  收藏  举报