Classes in Java
Everything we do in Java is part of a class
This means that none of our functions can be “global” like they can be in
C or C++
Classes in Java specify types, as they do in C++ and allow us to
create abstractions
Classes must be specified as public, or not.
Only public classes are available for the outside world to create objects of
If the keyword public doesn’t precede a class, then it is “friendly” and
only classes from within this file or package (a group of files) can create
objects Every package (or file to begin with) has a public class
Inside of a class, Java supports public, protected, and private
access (or nothing – which means “friendly” access)
But unlike C++, it requires that they be specified in front of each member
rather than specifying categories!
This means that everything has some kind of access specified for it.