zl程序教程

您现在的位置是:首页 >  后端

当前栏目

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

方法 知识 static main 原来 类中 public 放在
2023-09-14 08:58:29 时间

 

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

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();
        }
    }
}