Is there any convention for fields with name same as java keyword? For example want to create field with name "public":
public class Event{
   private boolean public_;
}
                The general convention (nothing official, but for experience) in this cases is to add the name of the class as a suffix.
private boolean publicEvent
There is no standard convention since the code convention document released by sun in 1999.
The only reference to variable names on that document is the following (chapter 9):
Except for variables, all instance, class, and class constants are in mixed case with a lowercase first letter. Internal words start with capital letters. Variable names should be short yet meaningful. The choice of a variable name should be mnemonic— that is, designed to indicate to the casual observer the intent of its use. One-character variable names should be avoided except for temporary “throwaway” variables. Common names for temporary variables are i, j, k, m, and n for integers; c, d, and e for characters.
As you can see there is no reference to how to use a keyword as variable name. The only tip that I can suggest are:
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