I’m tidying up some of my code with the correct scope on some methods and attributes (I have two classes and at the moment I have a number which I just declared as public to get working, but I feel I should look into this and make private where possible, for better practice)
When working in eclipse it’s suggested on one method, when i change it private from public, that I can fix it by dropping off the scope so the method just says “static void” instead of public/private static void.
Is this a better scenario to have nothing, rather than private or public – or is the default scope equivelant to public anyway ?
Thanks
The default Java scope is “package level”, i.e., every other class in the same package can access the method/field, but nothing outside the package can. It’s distinct from
public,protectedandprivate.