Java Naming Convention
Naming Convention Oracle documentation:
Thinks to name in Java are:
Naming Convention Oracle documentation:
Thinks to name in Java are:
- Classes
- CamelCase
- Class names should be nouns - they represent things
- Start with capital letter e.g. MyNewClass
- ArrayList
- LinkedList
- String
- TopSong
- Main
- Variables
- mixedCase
- start with lower case
- Meaningful and indicative
- Packages
- low case
- unique
- internet domain name - reversed as a prefix
Examples:
Invalid
Switch.supplier.com
Valid
com.supplier._switch
- Methods
- mixedCase
- Often verbs
- Reflect the function
- size()
- getName()
- addPlayer()
- Constants
- represent constants values
- ALL_UPPER_CASE
- MAX_INT
- SEVERITY_ERROR
- P1 = = 3,141592653
- Type Parameters
- single character, capital letters
- E-Element
- T-Type
- V-Value
- Interfaces
Komentarze
Prześlij komentarz