Browse - Programming Tips - Why do I get "attempting to assign weaker access privileges; was public" when I override toString() ?

Date: 2012sep26
Language: Java

Q.  Why do I get "attempting to assign weaker access privileges; was public" when I override toString() ?

[javac] MyClass.java:NN: error: toString() in MyClass cannot override toString() in Object [javac] String toString() { [javac] ^ [javac] attempting to assign weaker access privileges; was public
A. You just need to change
@Override String toString() {
to
@Override public String toString() {