私は次のクラスを持っています:
class Label{
static PopOver contextMenu; // can I put = new PopOver(); here?
Label(){
if(Label.contextMenu == null){ //null reference exception here why????
Label.contextMenu = new PopOver();
}
}
}
しかし、nullLabel.contextMenu
をチェックしているときに null 参照例外を取得する必要がありますか? また、宣言した場所で静的メンバーをインラインで初期化できますか?