gene c13,629 Points
doesn't the public method to get the answer defeat the purpose of a private answer variable
Is there a way for only the prompter.java file to access the private answer variable? if not, anyone can access and get the answer with the public getAnswer() method.
Steven Parker182,492 Points
The primary benefit of of the private variable isn't to prevent other code from reading it (since as you observed, there's a public method for that); but it's to prevent any other code from changing that value.