java静态成员的初始化过程
2024-08-25 11:06:07
public class Price{
final static Price INSTANCE = new Price(2.8);
static double initPrice = 20;
double currentPrice; public Price(double discount){
currentPrice = initPrice - discount;
}
}
public class Main { public static void main(String[] args) { System.out.println(Price.INSTANCE.currentPrice); Price p = new Price(2.8);
System.out.println(p.currentPrice);
}
}
最新文章
- float4与half4数据类型
- 程序员能力矩阵 Programmer Competency Matrix
- addEventListener、attachEvent、cancelBubble兼容性随笔
- [转]B树、B-树、B+树、B*树
- rabbitmq学习笔记2 基本概念
- 李洪强iOS学习交流群-iOS大神群
- Android平台程序崩溃的类型及原因列举
- java 产生随机数
- (转)UIWebView与JavaScript的那些事儿
- Android SD卡创建文件和文件夹失败
- 通过VMware安装Linux操作系统
- Amazon Alexa登录授权(Android)
- Prim最小生成树板子
- MySQL之表相关操作
- DELPHI中MDI子窗口的关闭和打开
- 推荐一个实用的 .gitignore 文件
- phpbbchina恢复上线
- Nginx深度优化
- rabbitmq日志记录进出的每条消息
- 分割回文串 II · Palindrome Partitioning II
热门文章
- RadGrid SelectedIndexChanged 事件没反应的解决方法
- tttt
- 移动web开发中遇到的一些问题收纳
- AFNetworiking与ASIHttpRequest对比
- 解决Windows 7/win8 使用VMware虚拟机的NAT 不能上网
- a:hover和a:visited书写顺序的重要性
- android WebView, WebChromeClient和WebViewClient加载网页基本用法
- hdr(host), hdr_beg(host) , path_beg
- unix c 08
- hdu3870-Catch the Theves(平面图最小割)