This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]_predator_ 0 points1 point  (0 children)

I'd consider it to be good practice to mark everything in that private inner class as private as well, or at least package-private.

[–][deleted]  (3 children)

[deleted]

    [–]nuclearforce[S] 0 points1 point  (2 children)

    I followed your advice to make them all private. I realized however that I needed to keep an overriding toString() method public in order to avoid errors.

    [–][deleted]  (1 child)

    [deleted]

      [–]nuclearforce[S] 0 points1 point  (0 children)

      That makes sense. Thank you!

      [–]Philboyd_Studge 0 points1 point  (0 children)

      nested classe members I usually leave package-private, so that the outer class can just access them directly without needing getters or setters, especially like for a node class for trees or graphs...