Sweet! By adding public
before the declaration, any other class in the project can access name
.
Psst: public
and private
are so-called modifiers. If we skip them, variables and methods are package-private, which is somewhere in between.
Nope, we want name to be accessible for anyone.