Sunday, March 31, 2013

How to format java source nicely with Eclipse

This is an Eclipse built-in feature to help us format java source nicely.
During development, the source code could be written in anyway, eg, code in a single line too long, thus need to scroll left and right to read.
This is very important, so that our source codes are easy to read and maintain at the future.

To resolve this problem, we can simply invoke this function in Eclipse to format it nicely and easily.

Steps:
1. format a source file.
    a) R-click on the target source file > source > format.

2. format the entire java project.
    a) R-click on the target project > source > format.



Done!!

LinkWithin

Related Posts Plugin for WordPress, Blogger...