How to change the Java default curly braces alignment and java parentheses alignment

Source: Internet
Author: User

How to change the Java default curly braces alignment and java parentheses alignment


(1) Many programmers feel that this is not so neat when using the brackets alignment of Java!


Many people are wondering why:

public class HelloWorld{   pulic static void main(String[] args){     System.out.println("Hello World");   }}

Rather than this (I personally feel this alignment is more comfortable! Look great !)
public class HelloWorld{   pulic static void main(String[] args)  {     System.out.println("Hello World");   }}


(2) OK! The solution is coming! Please look down!


Step 1: window -----> preferences ------> Java -------> Code Style -------> Formatter.



Step 2: Click Edit -------> Braces



You can see the Same Line or something !!! Oh, you understand !!

Step 3: Click the Same Line drop-down box and you will see Next Line. Then you can see the effect on the right!



Step 4: enter the name of this format in Profile name! Click OK



Step 5: select the format you just named in Active profile (here I am using MyselfEclipse [built-in])


In the above drop-down box, you can also select the default format Eclipse [Bucket-in] OK!


With obsessive-compulsive disorder, you can finally rest assured! I am in a good mood. Abuse me as much as possible!




How to achieve automatic alignment with curly brackets when developing Android using eclipse? It turns out that eclipse is alignment in java but still not alignment in Android

Press ctrl + shift + f to format the code

How to set the alignment of Dev C ++ curly brackets?

There is no place to set it. In fact, it is more convenient to use other text editing tools, such as ultraedit. When your text is in the C/C ++ syntax, it can make brackets automatically alignment on the same column, which is very convenient to use. It is much better than the editor with dev c ++.

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.