If we don’t specify any access specifiers like Public, Private and Protected for the instance variables and methods of a class, we call it as default access specifier.
In case of default access specifier, all the methods and instance variables will be ‘public’ (i.e. accessible) by default for all the classes inside the package, but where as they will be ‘private’ (i.e. not accessible) by default for the code that is outside the package.
In our previous post, we’ve specified all the instance variables and methods of the class as ‘public’. In this case the code inside the package and outside the package is able to access the instance variables and methods which are specified as public. Click here to download this project and follow the below steps to find out how the default access specifier controls the access:
1. Import the downloaded project into Eclipse IDE and ensure that…
View original post 304 more words