0

What is the difference between specifying public and default access modifiers to constructers

suppose the class name is Person, constructers are like Person() { } or public Person() { } I guess in the former case, the access modifier is default, so the constructer wont be accessible from outside the package. In this case what if the class itself is public¿

15th Oct 2016, 7:02 PM
Gopikrishnan R
Gopikrishnan R - avatar
1 Réponse
+ 3
Thats a good question but i think logic answers that. Basically if the class is public and the constructor has a default access specifier that essentially means the class is accessible everywhere but objects of that class can only be instantiated within the same package.
15th Oct 2016, 11:17 PM
Ousmane Diaw