Why is the access to a private field not forbidden?

前端 未结 6 2222
無奈伤痛
無奈伤痛 2020-12-21 02:04

For my study in the university I\'m forced to do some ugly java basics, like working without encapsulation, main method in the same class etc. (I do not want to open a discu

6条回答
  •  轮回少年
    2020-12-21 02:45

    You can access private fields from inside their class. That's the point of having them defined per-class.

提交回复
热议问题