Answer:
No. The program will not compile.
Compiler Complaints
Here is what the compiler outputs for the mistaken program:
compiling: CheckingAccountTester.java
CheckingAccountTester.java:55:
No method matching incrementUse() found in class CheckingAccount.
bobsAccount.incrementUse();
^
CheckingAccountTester.java:56:
Variable useCount in class CheckingAccount not accessible from class CheckingAccountTester.
bobsAccount.useCount = 15;
^
2 errors
The main() method cannot use the private variable useCount
nor can it use the private method incrementUse().
These can only be used by the other methods of the object.
The main() method can use bobsAccount.processCheck()
which is not private.
It in turn uses the private method incrementUse().
This is OK.
QUESTION 10:
Does using private increase the security of Java programs
for the Web?