Java Method Naming Conventions

I have a boolean field called showLabelsin the Bean class and I want to provide it with getter and setter methods. The installer will be setShowLabels, but if the getter is isShowingLabels, isShowLabels(is this really strange sound) or setShowLabels?

+3
source share
1 answer

This should be isShowLabelsstrange, as it may sound like an agreement . You can always rename a boolean value to showingLabels.

+8
source

Source: https://habr.com/ru/post/1770835/


All Articles