Eclipse uses 4 spaces instead of tab

Source: Internet
Author: User

As mentioned in the Java Code Specification, tab is actually 8 characters, so we can use 4 spaces (4 characters) instead of tab, which reduces the storage size of the code and provides an aesthetically pleasing code.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/59/B1/wKiom1TcFxvj5NddAADamixE3aU997.jpg "style=" float: none; "title=" Reference.png "alt=" Wkiom1tcfxvj5nddaadamixe3au997.jpg "/>

So modifying the encoding format of Eclipse helps us to replace it without changing our habits.

The steps are as follows:

  1. When editing, the tab is replaced. Text Editors, Editors, General, Windows-Preferences, select the Insert spaces for tabs.

    650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/59/AD/wKioL1TcGBKyCduvAAQyhp4EV-w036.jpg "title=" Text-editor.png "style=" Float:none; "alt=" wkiol1tcgbkycduvaaqyhp4ev-w036.jpg "/>

  2. Replace the tab with CTRL + Shift + F when formatting the code. Preferences, Java, Code style, Formmater, Windows----Active profile Select a formatting style, and then click Edit. In the Indentation tab, locate the general settings and select Spaces only in the tab policy.

    650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/59/B1/wKiom1TcFxyzn-5qAAQG9i7JQlE677.jpg "title=" Formatter.png "style=" Float:none; "alt=" wkiom1tcfxyzn-5qaaqg9i7jqle677.jpg "/>


    If the following occurs after selection, return to active profile, then click on the new one to enter the name at random. Then select the new profile and do the above.

    650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/59/AD/wKioL1TcGBLxogIgAAUVDNeHXa8145.jpg "title=" Error.png "style=" Float:none; "alt=" wkiol1tcgblxogigaauvdnehxa8145.jpg "/>

This article is from the "Sg-yyz" blog, make sure to keep this source http://sgyyz.blog.51cto.com/5069360/1613955

Eclipse uses 4 spaces instead of tab

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.