How can I identify an anonymous inner class in a NotSerializableException

前端 未结 2 1554
我寻月下人不归
我寻月下人不归 2020-12-04 02:06

I have received the following error message when trying to debug an application in NetBeans:

java.io.WriteAbortedException: writing aborted; java.io.N

2条回答
  •  鱼传尺愫
    2020-12-04 02:34

    Board$1 is the first anonymous class encountered in Board.java. For example:

    class Board {
      public static void main(String[] args) {
        new Object() {}; // Board$1
        new Object() {}; // Board$2
      }
    }
    

    With an IDE like Eclipse, it's easy to spot those anonymous classes in the outline view. I'm sure NetBeans has similar views:

    enter image description here

提交回复
热议问题