In Java, every variable must be declared with a data type before it is used. Java supports three kinds of variables: Local variables (inside methods), Instance variables (inside a class, per object), and Static variables (shared across all objects of a class).
Java Naming Standards
- Use
camelCasefor variables and methods (e.g.,studentAge,calculateTax()). - Use
PascalCasefor class names (e.g.,BankAccount). - Use
UPPER_SNAKE_CASEwithfinalfor constants (e.g.,MAX_USERS).
ADVERTISEMENT