java初始化测试
2016-01-14 20:06
459 查看
public class TestClassInitial { public static void main(String[] args){ Beetle b=new Beetle(); } } class Insect{ private int i=9; protected int j; Insect(){ System.out.println("i="+i+", j="+j); j=39; } { System.out.println(" insect"); } private static int x1=printStatic("static Insect.x1 init"); static{ System.out.println(" static insect"); } public static int printStatic(String string) { // TODO Auto-generated method stub System.out.println(string); return 1; } } class Beetle extends Insect{ private String k="k"; static{ System.out.println("static Beetle"); } { System.out.println("Beetle"); } public Beetle(){ System.out.println("construct Beetle"); } private static int x2=Insect.printStatic("beetle x2"); }
static Insect.x1 init static insect static Beetle beetle x2 insect i=9, j=0 Beetle construct Beetle
相关文章推荐
- java web 学习十三(使用session防止表单重复提交)
- Java虚拟机-相关参数
- 1分钟不用改任何代码在Eclipse中使用AAR
- Java笔记6:多态
- Struts2标签取值方式
- Java虚拟机-对象的创建,对象头
- Java学习篇之---基本数据类型
- Spring 核心 Ioc(DI)
- JAVA泛型详解
- JAVA线程基础
- Java虚拟机-内存区域,堆,栈
- JAVA获得任务栏高度
- JAVA中的多线程
- javabean 简介
- Struts2 <s:token/>标签 防止表单多次提交
- struts2 中, iterator 标签 取不到action中变量的值
- Java单例模式以及线程安全性的保证
- spring mvc中,如何在 Java 代码里,获取 国际化 内容
- struts2 下载文件
- struts2 跳转至404 页面的解决方案