Exercises, examples and other material relating to training module J709. This topic is presented on public courses Learning to Program in Java
, Java Bootcamp
, Java Programming for the Web
In order to provide the security of data and methods within classes, Java limits access through "the four Ps" Ð private, package, protected and public. Correct design of your objects and correct specification of the right "P" ensures that you can make all necessary methods and data available to users of your class, while at the same time hiding your internal workings.
Related technical and longer articles"Java Cookbook" - review
|Articles and tips on this subject||updated|
|4398||Accessing variables across subroutine boundaries - Perl, Python, Java and Tcl|
In a perfect programming world, code is broken into named blocks (methods, functions, subroutines, classes, procedures, commands, modules, packages etc) and data is passed around between the blocks purely as parameters and return values. And variables are local to the block in which they're used. This ...
|3142||Private and Public - and things between|
A public train service is one which is available for anyone to travel on; a private one only takes limited passengers as invites / made available by the operator. And there could be intermediate levels too - I understand that at times the British Transport Police protect the last train from Weymouth ...
|3047||What is a universal superclass? Java / Perl / Python / Other OO languages|
In any object oriented language, all objects will ultimately inherit from a base class supplied with the language, whether it's explicitly stated or not. That's because every class that you write will need that basic facilities to set up members (objects), and it's also useful to provide you with a ...
|2535||When should I use Java, Perl, PHP, or Python?|
Java is a good language for bigger systems ... teams of programmers writing bits of code that interact with each other. In fact, Java is so well tuned towards the bigger systems that it's not the ideal language for smaller systems - for the people who are just looking to write a quick piece of code ...
|2419||Where is my Java class?|
Exception in thread "main" java.lang.NoClassDefFoundError: Gerald
OK - so where did Java look, and where should it have looked?
Java looks for classes in each of the locations in the CLASSPATH environment variable in turn - each of those locations being either a directory or a .jar file which contains ...
|874||Who can use which access door?|
Anyone can come to our front door and ring the bell. It's then up to us whether we admit them to the house, or deal with them at the door. You can describe the front door as being public.
The side door through Lisa's office is more restricted, and whilst I and other members of the team can gain access ...
Examples from our training material
Some modules are available for download
as a sample of our material or under an Open Training Notes License
for free download from [here]
Topics covered in this module
Private, public, package and protected.
If you are looking for a complete course and not just a information on a single subject, visit our Listing and schedule
Well House Consultants specialise in training courses in
. We run
throughout the UK (and beyond for longer courses), and
at our training centre in Melksham, Wiltshire, England.
It's surprisingly cost effective to come on our public courses -
even if you live in a different
country or continent to us
We have a technical library of over 700 books on the subjects on which we teach.
These books are available for reference at our training centre.