例如:
import java.util.Objects;/** * * @author cmx */public class static_function { public static void main(String[] args) { //静态方法举例(API中以static开头的方法为静态方法): java.util.Objects包中的 static int hashCode(Object a) System.out.println(Objects.hashCode("hello")); //非静态方法举例(API中没有以static开头的方法为非静态方法): java.lang.Object包中的public int hashCode() System.out.println("hello".hashCode()); /** * 总结:静态方法static ,需要 :类名.方法名(参数); * 非静态方法:需要:对象名.方法名(); 括号内为空; * 比如Employee中的getName */ }}