header

For BE/B.Tech/BCA/MCA/ME/M.Tech Major/Minor Project for CS/IT branch at minimum price Text Message @ 9424820157

Naming Conventions in Java

 Naming Conventions in Java




Naming conventions are standard practices for class, interface, methods, etc. to identify and to distinguish from each other.

the class name should start from the upper case English alphabet.
example: Hello

interface the name should also start from the upper case English alphabet.
example: Demo

variables/objects/instances should start from the lower case.
example: apple

the method should start from the lower case.
example : mango()

constants should have all letters in uppercase and underscore should be used for separation of two words.
example: APPLE_BANANA

the package name should start with lower case
example: red

Companies use their reverse internet domain address for defining package names.

generally, the company uses the format :

extension.companyname.projectname.packagename.

if the company name is 'himanshupal' and extension is 'com' and let it be the name of the project is 'a1' and the package name is 'b1'.
than package will be :
com.himanshupal.a1.b1

internal company naming collisions need to be handled by company itself.


Camel case convention : 

When two words are combines then the second word should start with upper like appleMango

Naming conventions are not rules that everyone has to follow. these are standard conventions that everyone should follow so as to increase the readability of programmers.

Here is a sample program showing naming conventions : 


package hello;                  //declaration of package name

public class TestNamingConventions {        //declaration of class name


private int age;       //declaration of variables/objects/instances
private final static String CITY_INDORE;             //declaration of constants

 public void a(){                            //declaration of the method name
  System.out.println("Hi this is Himanshu");
 }

public static void main(String[] args) {

TestNamingConventions  obj  =  new TestNamingConventions();

 obj.a();
}

}

Output :
Hi this is Himanshu

Advantages of naming conventions :

1) Understanding code becomes easy for other programmers.
2) We can easily distinguish methods, variables, constants, etc.
3) Coding is performed in a standard way.  


No comments:

Post a Comment



Please go through below tutorials:


Mule 4 Tutorials

DEPLOY TO CLOUDHUB C4E CLIENT ID ENFORCEMENT CUSTOM POLICY RABBIT MQ INTEGRATION
XML TO JSON WEBSERVICE CONSUMER VM CONNECTOR VALIDATION UNTIL SUCCESSFUL
SUB FLOW SET & REMOVE VARIABLE TRANSACTION ID SCATTER GATHER ROUND ROBIN
CONSUME REST WEBSERVICE CRUD OPERATIONS PARSE TEMPLATE OBJECT TO JSON LOAD STATIC RESOURCE
JSON TO XML INVOKE IDEMPOTENT FILTER FOR EACH FLAT TO JSON
FIXWIDTH TO JSON FIRST SUCCESSFUL FILE OPERATIONS EXECUTE ERROR HANDLING
EMAIL FUNCTIONALITY DYNAMIC EVALUATE CUSTOM BUSINESS EVENT CSV TO JSON COPYBOOK TO JSON
CHOICE ASYNC

Widely used Connectors in Mule 3

CMIS JETTY VM CONNECTOR SALESFORCE POP3
JMS TCP/IP WEBSERVICE CONSUMER QUARTZ MONGO DB
FILE CONNECTOR DATABASE CONNECTOR


Widely used Scopes in Mule 3

SUB FLOW REQUEST REPLY PROCESSOR CHAIN FOR EACH CACHE
ASYNC TCP/IP COMPOSITE SOURCE POLL UNTIL SUCCESSFUL
TRANSACTIONAL FLOW

Widely used Components in Mule 3

EXPRESSION CXF SCRIPT RUBY PYTHON
JAVASCRIPT JAVA INVOKE CUSTOM BUSINESS EVENT GROOVY
ECHO LOGGER


Widely used Transformers in Mule 3

MONGO DB XSLT TRANSFORMER REFERENCE SCRIPT RUBY
PYTHON MESSAGE PROPERTIES JAVA TRANSFORMER GZIP COMPRESS/UNCOMPRESS GROOVY
EXPRESSION DOM TO XML STRING VALIDATION COMBINE COLLECTIONS BYTE ARRAY TO STRING
ATTACHMENT TRANSFORMER FILE TO STRING XML TO DOM APPEND STRING JAVASCRIPT
JSON TO JAVA COPYBOOK TO JSON MAP TO JSON JSON TO XML FLATFILE TO JSON
FIXWIDTH TO JSON CSV TO JSON


Widely used Filters in Mule 3

WILDCARD SCHEMA VALIDATION REGEX PAYLOAD OR
NOT MESSAGE PROPERTY MESSAGE IDEMPOTENT FILTER REFERNCE
EXPRESSION EXCEPTION CUSTOM AND


Exception Strategy in Mule 3

REFERENCE EXCEPTION STRATEGY CUSTOM EXCEPTION STRATEGY CHOICE EXCEPTION STRATEGY CATCH EXCEPTION STRATEGY GLOBAL EXCEPTION STRATEGY


Flow Control in Mule 3

CHOICE COLLECTION AGGREGATOR COLLECTION SPLITTER CUSTOM AGGREGATOR FIRST SUCCESSFUL
MESSAGE CHUNK AGGREGATOR MESSAGE CHUNK SPLITTER RESEQUENCER ROUND ROBIN SOAP ROUTER