In Java, when I declare a variable final static just like "final static int a;", is "a" protected or public?
Asked
Active
Viewed 71 times
1
-
2When you don't write the modifier it is 'default'. Neither protected nor public. – Parth Lukhi Nov 03 '18 at 06:57
-
@sn42 I got it! I mixed default access specifier up with protected. Thanks!!! – Victoria Nov 03 '18 at 07:14
-
@ParthLukhi I got it. Thanks !!! – Victoria Nov 03 '18 at 07:16
1 Answers
0
When you don't specify an access modifier, it is always default
modifier. Default modifier means the field will be accessible from inside the same package to which the class belongs. Checkout some examples of default
modifier here

Yogesh D
- 1,558
- 14
- 29
-
-
I think the default is also named "package", no? Meaning that its scope is for the current package. Here's a more official link: https://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html – android developer Nov 03 '18 at 07:30