当前位置:网站首页>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
}
边栏推荐
- FL Studio20.9水果软件高级中文版电音编曲
- 关于白盒测试,这些技巧你得游刃有余~
- Last day of the second quarter
- Short message sending solution in medical his industry
- How to maintain efficient collaboration in remote office and achieve stable growth of projects | community essay solicitation
- Use of laravel carbon time processing class
- There is no future to be expected. It is just the last fantasy of a migrant worker before he dies
- laravel 事件 & 监听
- [fundamentals of wireless communication-15]: illustrated mobile communication technology and application development-3-overview of digital communication 2G GSM, CDMA, 3G wdcma/cdma200/td-scdma, 4G LTE
- 软件开发中的上游和下游
猜你喜欢

AS400 API 从零到一的整个历程

视频教程 | 长安链推出系列视频教程合集(入门)

electron之坑addon

工作八年的程序员,却拿着毕业三年的工资,再不开窍就真晚了...

The whole process of AS400 API from zero to one
![SQL语句关联表 如何添加关联表的条件 [需要null值或不需要null值]](/img/91/0efbc13597be4dba5b9cf4e8644e35.png)
SQL语句关联表 如何添加关联表的条件 [需要null值或不需要null值]

There is no future to be expected. It is just the last fantasy of a migrant worker before he dies

CorelDRAW 2022中文精简64位直装版下载

1500w播放下还藏着什么热点?B站2个未来趋势你不得错过

What will Web3 bring in the future?
随机推荐
7-2 拼题A打卡奖励 dp
[queue] 933 Number of Recent Calls
laravel+redis 生成订单号-当天从1开始自增
php将二维数组元素转为键值对
Upstream and downstream in software development
小程序中实现excel数据的批量导入
[proteus simulation] Arduino UNO +74c922 keyboard decoding drive 4x4 matrix keyboard
Laravel event & Monitoring
关于白盒测试,这些技巧你得游刃有余~
【毕业季·进击的技术er】--毕业到工作小结
Log4j2 ThreadContext日志链路追踪
Live shopping mall source code, realize left-right linkage of commodity classification pages
机器学习10-信念贝叶斯分类器
3500字归纳总结:一名合格的软件测试工程师需要掌握的技能大全
PHP通过第三方插件爬取数据
org. redisson. client. Redisresponsetimeoutexception: redis server response timeout (3000 ms) error resolution
Fast understanding of forward proxy and reverse proxy
Sitge joined the opengauss open source community to jointly promote the ecological development of the database industry
Log4j2 threadcontext log link tracking
数学知识:求组合数 III—求组合数