静态方法
语法:
类名.静态方法();
注意:没有static,必须要new实体化!
public class demo {
static public void show(){
System.out.println("Hello");
}
public static void main(String[] args) {
demo.show();
}
}
等效于
public class demo {
public void show(){
System.out.println("Hello");
}
public static void main(String[] args) {
demo a=new demo();
a.show();
}
}