Sunday, 7 February 2016

JAVA Coding standards

                                                               
Sun Micro Systems defined some set of rules for defining identifiers. But java compiler won’t consider these rules. These rules are for JAVA coding standers.
                        
Important Point: In real time we must and should follow these coding standards.

Standards:

Rule for declaring class:
                                First letter of each word is Caps
                                Ex. Sample, SampleDemo

Rule for declaring Method:
                                Second word onwords following camel case
                                Ex. method(),methodOne()

Rule for declaring interface:
                                It is following the class declaration rule

Rule for declaring JavaBeans
                                1. All the members should be private
                                2. Setters don’t have return type
                                3. Setters have private access
                                4. Getters have public access modifier
                                5. Getters have return type of corresponding data member data type declared.
                                6. Getters have return type whereas setters don’t.
                                7. Setters have parameter whereas getter doesn’t.
  



 

No comments:

Post a Comment