当前位置:网站首页>Static domain and static method
Static domain and static method
2022-07-01 01:52:00 【Hades hadir】
Static domain
class Employee {
private static int nextId = 1;
private int id;
}
- Each employee object has its own id Domain , But all instances of this class share one nextId Domain
- namely , If there is 1000 individual Employee Class object , Then there are 1000 Instance fields Id, But there is only one static domain nextId
- Even if there is no employee object , Static domain nextId Also exist
- Static fields belong to classes , Does not belong to any independent object
- In most object-oriented programming languages , Static fields are called class fields
static const
- Very few static variables , But static constants are often used .
Static methods
- A method that cannot perform an operation on an object
Static methods don't have this Parameter method
- Static methods cannot access instance domains , But you can access static domains in your own classes
public static int getNextId(){
return nextId; //return static field
}
边栏推荐
- go导入自建包
- Mathematical knowledge: finding combinatorial number IV - finding combinatorial number
- Batch import of Excel data in applet
- After working for 6 years, let's take stock of the golden rule of the workplace where workers mix up
- Handsontable data grid component
- There is no future to be expected. It is just the last fantasy of a migrant worker before he dies
- P6773 [NOI2020] 命运(dp、线段树合并)
- Institute of Microbiology, commonly used biochemical reactions in microbiological testing
- [stack] 921 Minimum Add to Make Parentheses Valid
- php将二维数组元素转为键值对
猜你喜欢

视频教程 | 长安链推出系列视频教程合集(入门)
![[fundamentals of wireless communication-14]: illustrated mobile communication technology and application development-2-the first generation mobile analog communication big brother](/img/fa/f9bad44147ba9af21183b7bd630e32.png)
[fundamentals of wireless communication-14]: illustrated mobile communication technology and application development-2-the first generation mobile analog communication big brother

Selenium classic interview question - multi window switching solution

How does ZABBIX configure alarm SMS? (alert SMS notification setting process)

Unknown database connection database error

3dsmax plug-in development traversal node object and object acquisition and inode transformation matrix description

For the sustainable development of software testing, we must learn to knock code?

Qt5 mvc: revealing the secrets of data visualization
![[Qt5 basics] random number display](/img/1f/a3d310788dbc45c71d3b5c47d50a5b.png)
[Qt5 basics] random number display

LabVIEW计算相机图像传感器分辨率以及镜头焦距
随机推荐
What other hot spots are hidden under 1500W playback? Station B 2 future trends you can't miss
Some essential differences
[fundamentals of wireless communication-14]: illustrated mobile communication technology and application development-2-the first generation mobile analog communication big brother
删除重复的电子邮箱
The whole process of AS400 API from zero to one
Live shopping mall source code, realize left-right linkage of commodity classification pages
MYSQL 数据库查看磁盘占用情况
Test essential tool - postman practical tutorial
Thinking about business and investment
Lecun, a Turing Award winner, pointed out that the future of AI lies in self-learning, and the company has embarked on the journey
数学知识:满足条件的01序列—求组合数
Clickhouse 消除由group by产生的间隙
7-2 拼题A打卡奖励 dp
Qt5 mvc: revealing the secrets of data visualization
Use of laravel carbon time processing class
【Content-Type请求头的内容】
How to maintain efficient collaboration in remote office and achieve stable growth of projects | community essay solicitation
[Agora] user management
工作6年,来盘点一下职场人混迹职场的黄金法则
opencv -- 笔记