Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does it mean when there's no explicit access modifier in Java?

Tags:

java

So if you have a method prototype like void myMethod(). What does that mean? What kind of access does it grant?

like image 761
user5243421 Avatar asked Jun 03 '26 16:06

user5243421


1 Answers

It means "package access". Basically any class that shares the same package as your declaring class can see/use the method. Subclasses cannot, unless they are in the same package as the superclass.

For more details, see here:

http://download.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html

like image 135
aroth Avatar answered Jun 05 '26 04:06

aroth



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!