Head First Java, Page 526, typed this up verbatim:
Why is the compiler outputting:
TestThreads.java:32: getAccum() has private access in Accum
Accum a = Accum.getAccum();
^
TestThreads.java:46: getAccum() has private access in Accum
Accum a = Accum.getAccum();
^
2 errors
Sandra Bachan wrote:
Why is the compiler outputting:
TestThreads.java:32: getAccum() has private access in Accum
Accum a = Accum.getAccum();
^
TestThreads.java:46: getAccum() has private access in Accum
Accum a = Accum.getAccum();
^
2 errors Please explain
Since the method getAccum() in the Accum class has the private access, you can't access it beyond that class. That's why you get Compilation Error! change it to public, then it will Compile perfectly!
|BSc in Electronic Eng| |SCJP 6.0 91%| |SCWCD 5 92%|