Classes and Interfaces:
- Class must match the name of file.
- As a best practice, the class name must be mixed case and first letter should always be capital.
- The class name should not contain any whitespace.
- Class name should not start with special characters.
Syntax:
class Employee {
}
Methods:
As a best practice, method name should be mixed case and always start with small case letter.
e.g. -> start(), getEmployeeName(), getEmployeeId()
Syntax:
class Employee {
public void start() {
}
public void getEmployeeName() {
}
public void getEmployeeId() {
}
}
Variables:
- As a best practice, method name should be mixed case and always start with small case letter.
e.g. -> name, age, firstName, lastName
2. variable name should not start with special characters.
3. Static variables name should always be start with capital and separate every word by underscore.
Syntax:
class Employee {
String name;
int age;
String firstName;
String lastName;
public static String UNIVERSITY_NAME; // static variable
}
Imran Khan, Adobe Community Advisor, AEM certified developer and Java Geek, is an experienced AEM developer with over 11 years of expertise in designing and implementing robust web applications. He leverages Adobe Experience Manager, Analytics, and Target to create dynamic digital experiences. Imran possesses extensive expertise in J2EE, Sightly, Struts 2.0, Spring, Hibernate, JPA, React, HTML, jQuery, and JavaScript.