Do objects encapsulate data so that not even other instances of the same class can access the data?

前端 未结 7 1652
梦如初夏
梦如初夏 2020-12-03 22:35

In Java,

Do objects encapsulate data so that not even other instances of the same class can access the data? Only when the keyword \"private\" is used? What are \"ac

7条回答
  •  情话喂你
    2020-12-03 23:03

    Even if a field/method is 'private', it can still be accessed/invoked via reflection unless you install a custom security manager that disallows that.

提交回复
热议问题