Why is the access to a private field not forbidden?

前端 未结 6 2218
無奈伤痛
無奈伤痛 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:42

    Yes—in Java, private is class private not instance private.

    Many other languages use instance private, eg Ruby and Smalltalk.

提交回复
热议问题