![]() |
VOOZH | about |
Naming conventions are a set of guidelines that define how to name identifiers such as classes, variables, methods, constants and packages in a uniform and meaningful way. These conventions help ensure clarity, reduce confusion, and maintain coding standards across projects and teams.
Note: Java widely follows the CamelCase style, where names are formed by joining multiple words and capitalizing each internal word.
Java defines clear rules for naming classes, methods, variables, packages, and constants. These conventions keep the code organized and self-explanatory.
class Student { }
class Integer { }
class Scanner { }
interface Runnable { }
interface Remote { }
interface Serializable { }
Methods should be verbs, in mixed case with the first letter lowercase and with the first letter of each internal word capitalized.
public static void main(String [] args) {}
Note: The main() method follows this rule and acts as the entry point of a Java program.
Variable names should be short yet meaningful.
Variable names should not start with underscore _ or dollar sign $ characters, even though both are allowed.
int[] marks;
double answer,
Note: As the name suggests one stands for marks while the other for an answer be it of any e do not mind.
final double PI = 3.14159;
double num = PI;
import java.util.Scanner ;
import java.io.*;
In the above examples: