How does access modifier impact the performance in Java?

后端 未结 2 1150
南旧
南旧 2021-01-27 00:08

In java programming, method level access modifiers using protected or public where private can be used will affect the performance in any way? if so in what what way it affects

相关标签:
2条回答
  • 2021-01-27 00:32

    Quoting erickson from the following answer:

    The access modifier on the field doesn't make any difference in speed, but invoking the accessor method does.

    ps. Please upvote the original answer instead of this one.

    0 讨论(0)
  • 2021-01-27 00:34

    Even if there is a theoretical difference, I doubt that there is a measurable diffrence. At least in any sensible Java runtime

    0 讨论(0)
提交回复
热议问题