当前位置:网站首页>12 static and static initialization parameter value transfer
12 static and static initialization parameter value transfer
2022-07-21 13:01:00 【Where is the shepherd boy】
Within the same category Within the same category In addition to static methods Calling other methods must first new Here is the method
object ;
Subordinate to There is no need to find someone I can't find — Static method facade Out of commission Non static method
But subordinate to the object You can call the ---- In the ordinary way You can call static methods directly
initiate static
Construction method Used for object initialization
initiate static Used for class initialization
Static statement block Class initializes ( Create a class ) That is, execute when loading code Ordinary methods cannot be called and class Because static methods and variables Are executed when creating classes The object has not been created yet
Sentence block Execute when constructing methods ( When you create an object )
public class teest {
public teest(int c){
System.out.println(c);
}
// Sentence block
{
System.out.println(" Statement block execution ");
}
// Static statement block
static {
System.out.println(" Static statement block execution ");
}
public static void main(String[] args) {
System.out.println(" Start execution ");
teest c= new teest(9);
}
}
//result
Static statement block execution
Start execution
Statement block execution
9
Two Parameter values
JAVA All parameters are Value passed That is, pass a copy of the value Copy change The original parameters will not be changed
When passing reference data types We send an address At this point, once the value pointed to by the copy changes The value of the original parameter to the position must also change character string Is a directional variable
Reference data type passing The transmission is also worth It's just This value is the address Once the address changes It will not affect the previous address
边栏推荐
- 写单元测试,没你想得那么简单!
- one million one hundred and eleven thousand one hundred and eleven
- KubeSphere 3.3.0 离线安装教程
- 选择通过专线/VPN网关/智能接入网关的自建数据库,填写VPC ID时候需要注意什么?
- Quantum computing + finance! D-wave joins hands with MasterCard, an international credit card organization
- LeetCode 練習——劍指 Offer 66. 構建乘積數組
- Markdown语法----数学表达式
- 【CCNA实验分享】三层交换机Vlan间路由
- 11.3构造方法
- Writing unit tests is not as simple as you think!
猜你喜欢
16 封装
22张图带你深入剖析前缀、中缀、后缀表达式以及表达式求值
【C语言】动态内存管理 - malloc等函数详解
写单元测试,没你想得那么简单!
LM386 practical schematic diagram
Xiaohongshu mall whole store commodity API interface (all store commodity interfaces)
2022清华暑校笔记之L2_1神经网络的基本组成
How to set measurable project goals?
A generation of "Boya" masters passed away! Memory of Professor yangfujia, former president of Fudan University and academician of the Chinese Academy of Sciences
【C语言】文件操作
随机推荐
P2404 自然数的拆分问题
【电商运营】教你这几招,告别无效预设回复
shell简介以及变量定义
12静态 和静态初始化 参数传值
新手小白如何搭建个人的服务器?
RS485 data line is connected reversely
[C language] file operation
WinForm UI interface design routine - multi thread access UI control
The regular expression gets the content between the two identities
Usage guide of guomi curl
生成验证码
17 多态
From cloud native to intelligent, in-depth interpretation of the industry's first "best practice map of live video technology"
Sqlserver BCP参数解释和字符格式选择和故障处理小结
字符串匹配(华为)
Market Research and investment forecast report of China's tungsten powder industry (2022 Edition)
元宇宙:技术演进、产业生态与大国博弈
绘图库Matplotlib安装配置
这可能是你见过的最全的网络爬虫总结
绘图库Matplotlib图形绘制