java多线程环境下类初始化死锁?
今天在使用iead写tij中的动态代理的时候遇到这个问题:
代码如下:
interface Null{}public class Person
{
public final String first ;
public final String last ;
public final String address ;
public Person(String first, String last, String address) {
this.first = first;
this.last = last;
this.address = address;
}
@Override
public String toString() {
return "Person: " + first + " " + last + " " + address ;
}
public static class NullPerson extends Person implements Null
{
private NullPerson()
{
super("None" , "None" , "None") ;
}
}
public static final Person NULL = new NullPerson() ;
}
这个问题该怎么理解呢?
回答:
我的mac上复制代码没有这个提示,环境是java1.8+idea14
以上是 java多线程环境下类初始化死锁? 的全部内容, 来源链接: utcz.com/p/176981.html