I like using question mark at the end of method/function names in other languages. Java doesn’t let me do this. As a workaround how else can I name boolean returning methods in Java? Using an is, has, should, can in the front of a method sound okay for some cases. Is there a better way to name such methods? For
Tag: naming-conventions
What is the convention for word separator in Java package names?
How should one separate words in package names? Which of the following are correct? com.stackoverflow.my_package (Snake Case using underscore) com.stackoverflow.my-package (Kebab Case using hyphens) com.stackoverflow.myPackage (Camel Case) com.stackoverflow.MyPackage (Pascal Case) What is the general standard? Answer Here’s what the official naming conventions document prescribes: Packages The prefix of a unique package name is always written in all-lowercase ASCII letters and
Coding Conventions – Naming Enums
Is there a convention for naming enumerations in Java? My preference is that an enum is a type. So, for instance, you have an enum I am opposed to naming it: I understand it is easy to pick off which files are enums, but then you would also have: Also, is there a good document describing the same for constants,
Naming convention for utility classes in Java
When writing utility classes in Java, what are some good guidelines to follow? Should packges be “util” or “utils”? Is it ClassUtil or ClassUtils? When is a class a “Helper” or a “Utility”? Utility or Utilities? Or do you use a mixture of them? The standard Java library uses both Utils and Utilities: javax.swing.Utilities javax.print.attribute.AttributeSetUtilities javax.swing.plaf.basic.BasicGraphicsUtils Apache uses a variety
Variable naming conventions in Java
In PHP, we (at least the good programmers) always start general variable names with a lower-case letter, but class variables/objects with an upper-case letter to distinguish them. In the same way we start general file names with a lower case letter, but files containing Classes with an upper case letter. E.g.: Are the conventions the same in Java, i.e., objects