class Student {
static {
System.out.println("Student 静态代码块");
}
{
System.out.println("Student 构造代码块");
}
public Student() {
System.out.println("Student 构造方法");
}
}
class Wg {
static {
System.out.println("Demo2_Student静态代码块");
}
{
System.out.println("Demo2_Student 构造代码块");
}
public static void main(String[] args) {
System.out.println("我是main方法"+(new Student()/*会打印出地址值*/));
}
}
为什么会打印出地址值? |
|