Java Final - an enduring mystery

后端 未结 4 663
心在旅途
心在旅途 2021-01-15 09:08
suggestBox.addKeyUpHandler( new KeyUpHandler() {
  public void onKeyUp(KeyUpEvent event) {
    if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) { 
      String bo         


        
4条回答
  •  不思量自难忘°
    2021-01-15 09:26

    Because the language designers thought it would be confusing if a variable referenced by an anonymous inner class were changed. If this weren't the case all local variable references referenced by the anonymous class would have to be lifted to be fields of that class.

提交回复
热议问题