Classes (Nouns)
- Should start with uppercase, for multiple words inner words should start with uppercase.
- eg : Student, Customer, String,etc
- Throwable is a class but not a interface.
Interfaces (Adjectives)
- Should start with uppercase, for multiple words inner words should start with uppercase.
- Eg: Runnable, Serializable,Clonable,Movable etc
- Should start with lowercase, for multiple words inner words should start with uppercase i.e camelcase.
- eg: run(), step(), getName() etc.
Variables (Nouns)
- Should start with lowercase, for multiple words inner words should start with uppercase i.e camelcase.
- rollNumber, name,mobileNumber etc.
Constants (Nouns)
- Should be only uppercase, multiple words should be separated by '_'
- Also its recommended to use static and final modifiers.
- MIN_VALUE,MAX_VALUE etc.
Java Bean Coding Standards
- Simple java class with private properties and public getters and setters.
- Could end with bean eg : "StudentBean".
- Setter should start with set ,with some argument and return type is void.
- Getter should start with get, with no argument and return type should not be void.
- For boolean property getter method should be prefixed with"is".
- For registering the listener we use add, and for de-registering we use remove as prefix.
0 Comments