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¿
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.