Java naming conventions

Java naming conventions are “rules” which a developer decide to use in his code. These rules are meant to make your code more understandable and easier to read for other developers. At first SUN, and then Oracle conventions to name the different Java types (packages, classes, interfaces, methods, variables and constants).

Some of the naming conventions are :

  1. Packages names should be all in lowercases;
  2. Classes and interfaces names should be capitalized;
  3. Methods names should be verbs;
  4. Variables names should be as short as possible, but meaningful.

For the exam you have to pay attention on questions regardless to the java legal identifier and to the java code convention. For example, a java variable name could be legal, but not recommended.

2 Comments

Add a Comment

Your email address will not be published.