To do so, simply go to Preferences > Java > Code Style > Formatter and choose the convenient option. Formatting: Eclipse can also format your source code if needed.Autocorrection: Don’t worry if you made the mistake when writing the code, Eclipse will detect and correct it.