- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Best practice for variable and method naming in Java
All Java components require names. Names used for classes, variables and methods are called identifiers. In Java, there are several points to remember about identifiers. They are as follows -
- All identifiers should begin with a letter (A to Z or a to z), currency character ($) or an underscore (_).
- After the first character, identifiers can have any combination of characters.
- A keyword cannot be used as an identifier.
- Most importantly, identifiers are case sensitive.
- Examples of legal identifiers: age, $salary, _value, __1_value.
- Examples of illegal identifiers: 123abc, -salary.
- Related Articles
- Java variable naming rules
- variable naming conventions of java
- Explain naming conventions for packages in java?
- What are Variable Naming Conventions in JavaScript
- Java variable declaration best practices
- The Best Management Practice Portfolio
- Best practice to wait for a change with Selenium Webdriver?
- Java Naming conventions
- Naming a thread in Java
- CamelCase in Java naming conventions
- Advantages of naming conventions in Java
- How to define the naming conventions for JSON field names in Java?
- Are HTML comments inside script tags a best practice?
- Best practices for Java comments.
- Practice Set for Recurrence Relations

Advertisements