Java静态变量块使用案例
2013-11-26 23:03
288 查看
package CH181;
/**
* Description:
* <br/>Copyright (C), 2008-2010, Yeeku.H.Lee
* <br/>This program is protected by copyright laws.
* <br/>Program Name:
* <br/>Date:
* @author Yeeku.H.Lee kongyeeku@163.com
* @version 1.0
*/
public class Test
{
static
{
//使用静态初始化块为b变量指定出初始值
b = 6;
System.out.println("----------");
}
//声明a变量时指定初始值
static int a = 5;
static int b= 9;
static int c;
public static void main(String[] args)
{
System.out.println(Test.b);
}
}
/**
* Description:
* <br/>Copyright (C), 2008-2010, Yeeku.H.Lee
* <br/>This program is protected by copyright laws.
* <br/>Program Name:
* <br/>Date:
* @author Yeeku.H.Lee kongyeeku@163.com
* @version 1.0
*/
public class Test
{
static
{
//使用静态初始化块为b变量指定出初始值
b = 6;
System.out.println("----------");
}
//声明a变量时指定初始值
static int a = 5;
static int b= 9;
static int c;
public static void main(String[] args)
{
System.out.println(Test.b);
}
}
相关文章推荐
- 数据字典生成Java代码
- maven工程下整合spring+mybatis+freemarker
- eclipse基本使用
- Eclipse快捷键与使用技巧总结
- Java基础之线程——派生自Thread类的子类(TryThread)
- Eclipse统计代码行数
- java 时间格式化
- java中的FileFilter接口如何使用
- java面向对象基础小结(二)
- java web 学习 --第一天(Java三级考试)
- struts2的简单的编程步骤
- java beanUtils框架
- Dive into Spring framework -- 了解基本原理(一)
- Java 内部类种类及使用解析【转】
- LOCAL_SHARED_LIBRARIES 与 LOCAL_LDLIBS,LOCAL_LDFLAGS的区别
- 【java】 基本数据类型之间的转换
- Java_io体系之DataInputStream、DataOutputStream简介、走进源码及示例——08
- Java基础知识学习二(数据类型及运算)
- java集合总结
- 深度解析Java内存的原型