静态方法的调用:
静态方法为加了static的方法,这时候在main方法里调用需要加"."就行,如定义了一个学生类
public class Student{
public void say(){
System.out.println(“学生说话了”);
}
}
,在另一个main方法里调用这个学生类只需要Student.say();就行,就是“类名.方法名”这种格式。
非静态方法调用:
当没有static,例如public void say(),在main方法里调用这个方法就需要先将对象实例化,即new一次,Student student = new Student();即对象类型--对象名--对象值,然后再用“类名.方法名”进行调用。