Code Formatter

The preview pane on this page demonstrates what each of these options will do to Java code in the editor.

Code Formatter Preferences

Option

Description

Default

Insert a new line before an opening brace The editor inserts a line break before opening a new brace. In other words, open braces always start at the beginning of a new line. Off
Insert new lines in control statements The editor inserts a line break before a new control statement. In other words, control statements (e.g., if, else, catch, finally, etc.) always start at the beginning of a new line. Off
Clear all blank lines The editor deletes all blank lines in the file. Off
Insert new line between 'else if' The editor inserts a new line between the words "else" and "if" in else-if statements. Off
Insert a new line inside an empty block The editor inserts a line break between empty braces. In other words, the left and right braces in an empty braces set will always appear on separate lines. An exception is if the right brace is followed by a keyword, in which case, the two braces appear on the same line. On
Maximum Line Length This is the maximum length of any one line. Lines longer than this number are split and wrapped. Entering 0 here disables line splitting completely. 80
Compact assignment The editor removes any spaces between a variable and an assignment statement so that they are asymmetrical (e.g., a= b;). Off
Indentation is represented by a tab The editor uses tabs instead of spaces to represent indentations. On
Amount of spaces representing a tab If the editor uses spaces instead of tabs to represent indentations, this is the number of spaces that comprises a single indentation. 4
Preview pane Shows an example of what your Java code will look like with the settings currently displayed on this page. n/a

Related tasks

Formatting Java code

Related reference

Java editor
Java editor preferences