+ 1
Please tell me what is a package??
I want to know what is default access specifier for classes
4 Answers
+ 5
A Java package is a mechanism for organizing Java classes into namespaces similar to the modules of Modula. Java packages can be stored in compressed files called JAR files, allowing classes to execute faster as a group rather than one at a time. Programmers also typically use packages to organize classes belonging to the same category or providing similar functionality
Java provides a default specifierwhich is used when no access modifier is present. Any class, field, method or constructor that has no declared access modifier is accessible only by classes in the same package. The default modifier is not used for fields and methods within an interface.
Java provides a default specifierwhich is used when no accessmodifier is present. Any class, field, method or constructor that has no declared access modifier is accessible only by classes in the same package. The default modifier is not used for fields and methods within an interface.
https://stackoverflow.com/questions/16164902/what-is-the-default-access-modifier-in-java
+ 2
A package is a group of classes sometimes group of packages.
And the default access specifier for classes is "default". If we do not mention the default access specifier for the classes then the compiler takes it under default accessibility.
If a class is declared as default then that class is accessible only in the package in which it is created.
0
okey got it
but SOLOLEARN says default makes class accessible in the same package. what does that mean?
0
thank you Gawen Steasy