If you Google then you will find lots of code and solution of your coding issue. but
The most important point is How Code should be?
When you are writing code in Java, As per my knowledge - There are points which should be implemented into code
Key Pointes are :
1. Always generate logs for your application.You can use apache Log4j.jar for that.
2. Don't generate log file into root of your application. Try to create new Log directory into your application,
and generate new log file for earch Run/Build into log folder
3. Naming convension of log file is important as well. it should be Ex. _DataandTimeStamp.log.
In order to create new log file each time your applicaton runs, you can create inherit superclass FileAppender
and overrid it's method and write logic to create new name with timestamp.
4. If your application require Global variable,which will be used throught your appplication(like Configuration) then you
should make define it into Properties and access it using ResourceBundle from Java.util package.
5. Exception Handling is one of the important factor which should be implemented into your program.
6. Don't use static absolute path. Better to use relative path Ex. path config/Resource.properties is better than
c:/myproject/src/config/Resource.properties
7. Write all your java files into packages rather than in Default package
The most important point is How Code should be?
When you are writing code in Java, As per my knowledge - There are points which should be implemented into code
Key Pointes are :
1. Always generate logs for your application.You can use apache Log4j.jar for that.
2. Don't generate log file into root of your application. Try to create new Log directory into your application,
and generate new log file for earch Run/Build into log folder
3. Naming convension of log file is important as well. it should be Ex.
In order to create new log file each time your applicaton runs, you can create inherit superclass FileAppender
and overrid it's method and write logic to create new name with timestamp.
4. If your application require Global variable,which will be used throught your appplication(like Configuration) then you
should make define it into Properties and access it using ResourceBundle from Java.util package.
6. Don't use static absolute path. Better to use relative path Ex. path config/Resource.properties is better than
c:/myproject/src/config/Resource.properties
7. Write all your java files into packages rather than in Default package