首页 > 编程知识 正文

java静态方法在哪,静态分配ip和动态分配ip的方法

时间:2023-05-03 07:28:21 阅读:268882 作者:561

例如:

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 */ }}

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。