静态方法的使用就不能new了,而是直接使用
1.创建一个接口,里面有一个静态方法
public interface jingtai {
public static void a() {
System.out.println("这是一个静态方法!");
}
}
2.使用
public class jingtai_shiyong {
public static void main(String[] args) {
//正确写法:
jingtai.a();
//错误写法
// 创建了实现类对象
// MyInterfaceStaticImpl impl = new MyInterfaceStaticImpl();
// impl.methodStatic();
}
}