当前位置:网站首页>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
边栏推荐
- 招聘需求 视觉工程师
- How Oracle converts strings to multiple lines
- All tutor information on one page
- 游戏资产复用:更快找到所需游戏资产的新方法
- L'enquête en aveugle a montré que les femmes étaient meilleures que les hommes.
- A classic interview question covering 4 hot topics
- 参考 | 升级 Win11 移动热点开不了或者开了连不上
- C# 解决使用SQLite 的相对路径问题
- [c++ primer notes] Chapter 4 expression
- Rough reading DS transunet: dual swing transformer u-net for medical image segmentation
猜你喜欢

支付宝微信支付业务流程图

(note) Anaconda navigator flashback solution

Analysis of orthofinder lineal homologous proteins and result processing

Understanding mvcc in MySQL transactions is super simple

2022.06.26(LC_6100_统计放置房子的方式数)

Redis master-slave replication and sentinel mode

MySQL environment variable configuration tutorial

我大抵是卷上瘾了,横竖睡不着!竟让一个Bug,搞我两次!

Redis的事务

Rough reading DS transunet: dual swing transformer u-net for medical image segmentation
随机推荐
分析日志.log
Redis configuration file details
i=i++;
lvgl使用demo及说明2
2022.6.26-----leetcode. seven hundred and ten
Ue5 magic power - POI solution
关于放大器失真的原因你了解多少呢?
05 observer mode
LVGL GUI GUIDER移植代码到STM32
RockerMQ消息发送模式
MySQL environment variable configuration tutorial
Redis配置文件详解
2022.6.26-----leetcode.710
[c++ primer notes] Chapter 4 expression
内存泄露的最直接表现
Design of a solar charge pump power supply circuit
静态代码块Vs构造代码块
[batch dos-cmd command - summary and summary] - how to distinguish the internal command and external command of CMD, and the difference between CMD command and run (win+r) command,
MySQL环境变量配置的教程
PayPal account has been massively frozen! How can cross-border sellers help themselves?