Does Java's access controller default and package-private mean the same thing?

Asked 2 years ago, Updated 2 years ago, 23 views

While studying Java with books, I am studying by searching for the parts I want to know more. In the book, the access controller public protected package-private private It says there's something In Jump to Java, There is default instead of package-private I want to know the difference between the two.

java

2022-09-21 15:32

1 Answers

It's a difference of expression.

It is expressed as default accessor by specifying an accessor without any keywords, and it is only expressed as package-private accessor because it can only be accessed from the package.

If you look at https://docs.oracle.com/javase/specs/jls/se10/html/jls-6.html#d5e10050, it is expressed as package-access.

I'm using the term package accessor.


2022-09-21 15:32

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.