当前位置:网站首页>Static code block vs construction code block
Static code block vs construction code block
2022-06-27 08:31:00 【C_ x_ three hundred and thirty】
class A {
public A() {
System.out.println("class A");
}
{ System.out.println("I'm A class"); }
static { System.out.println("class A static"); }
}
public class B extends A {
public B() {
System.out.println("class B");
}
{ System.out.println("I'm B class"); }
static { System.out.println("class B static"); }
public static void main(String[] args) {
new B(); class A static class B static I'm A class class A I'm B class class B
When new When an object
If there are static code blocks
The system will automatically help you execute the static code block first
If A Inherited B also A,B There are static code blocks
When you new A() when ,
The system will automatically execute first B The static code block of is executing A Static code block
Then suppose B And building blocks of code , Then finish the execution A,B After the static code block of
I'll do it again B The construction code block of , And then in the B Construction method of
And then in the A The construction code block of , And then in the A Construction method of
边栏推荐
- Read datasets iteratively with xgboost
- Blind survey shows that female code farmers are better than male code farmers
- [ 扩散模型(Diffusion Model) ]
- Chapter 11 signal (I) - concept
- C# 解决使用SQLite 的相对路径问题
- Creation process and memory layout of objects at JVM level
- 我大抵是卷上瘾了,横竖睡不着!竟让一个Bug,搞我两次!
- About the problem that the El date picker Click to clear the parameter and make it null
- 静态代码块Vs构造代码块
- 2022.6.26-----leetcode. seven hundred and ten
猜你喜欢

MySQL环境变量配置的教程
![[batch dos-cmd command - summary and summary] - output / display command - echo](/img/44/cddad70eeb756db15c19100c25c61a.png)
[batch dos-cmd command - summary and summary] - output / display command - echo

MySQL锁详解

L'enquête en aveugle a montré que les femmes étaient meilleures que les hommes.

並發編程JUC的AQS底層源碼

Rust async: SMOL source code analysis -executor

100% understanding of 5 IO models

How Oracle converts strings to multiple lines

ZABBIX deployment instructions (server+win client + switch (H3C))

Oracle uses an SQL to find out which data is not in a table
随机推荐
Zabbix部署说明(Server+Win客户端+交换机(H3C))
Game asset reuse: a new way to find required game assets faster
【云原生】2.3 Kubernetes 核心实战(上)
[c++ primer notes] Chapter 4 expression
Linux下Redis的安装
i=i++;
我大抵是卷上瘾了,横竖睡不着!竟让一个Bug,搞我两次!
IO管脚配置和pinctrl驱动
Fake constructor???
JVM常见的垃圾收集器
100%弄明白5种IO模型
Rough reading DS transunet: dual swing transformer u-net for medical image segmentation
Associated GIS: all roads lead to ue5 City
Redis transactions
一种太阳能电荷泵供电电路的方案设计
Chapter 11 signal (I) - concept
ZABBIX deployment instructions (server+win client + switch (H3C))
JS EventListener
[10. difference]
並發編程JUC的AQS底層源碼