java13天

构造函数

一个对象的建立,构造函数只运行一次。
而一般方法可以被该对象调用多次。
person p2=new person();//初始化构造函数
p2.p2content();//调用函数的内容,可重复调用
构造代码块中定义的是不同对象共性的初始化内容
class test
{
{
System.out.println(“whaterver tranfer conten1 or content2,it will transfer this code block “)
}
public static content1()
{}
public static content()
{}
}

评论

h
hw_7864

⭐️ Admin快速开发: https://show.cool-admin.com/

赞 0
h
hw_7864

⭐️ 官方文档: https://cool-js.com

赞 0
h
hw_7864

⭐️ chatgpt在线体验: https://cool-js.com/ai/chat-vip/index.html?r=helloworld

赞 0