Method names should always begin with a lower case character, and should not contain underscores.
The rules for Java variable naming are fairly lax. The first letter of a variable must be either a letter, dollar sign or an underscore. After that, any combination of valid Unicode characters or digits is allowed.
Variable names can never contain spaces. The underscore character ( _ ) can also appear in a name.
Variable names should not start with underscore ( _ ) or dollar sign ( $ ) characters, even though both are allowed. This is in contrast to other coding conventions that state that underscores should be used to prefix all instance variables. Variable names should be short yet meaningful.
I got confused with the (naming convention) use of underscore _
in variable names and method names as their starting letter. For example _sampleVariable
and _getUserContext()
. Could anybody clarify when to use it?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With