Sharing Names among the Parts of a Java Program
In This Chapter
Hiding names from other classes
Exposing names to other classes
Tweaking your code to find the right middle ground
Speaking of private fields and methods (and I do speak about these things in this chapter)… .
I’m eating lunch with some friends at work. “They can read your e-mail,” says one fellow. Another chimes in, “They know every single website that you visit. They know what products you buy, what you eat for dinner, what you wear, what you think. They even know your deepest, darkest secrets. Why, I wouldn’t be surprised if they know when you’re going to die.”
A third voice enters the fray. “It’s getting to the point where you can’t blow your nose without someone taking a record of it. I visited a website a few weeks ago, and the page wished me a Happy Birthday. How did they know it was me, and how did they remember that it was my birthday?”
“Yeah,” says the first guy. “I have a tag on my car that lets me sail through toll booths. It senses that I’m going through and puts the charge on my credit card automatically. So every month, I get a list from the company showing where I’ve been and when I was there. ...