3

I am using Intellij for Java development, but I prefer C# like coding style. How to format like C# code style? For example:

     if()
     {
          /// do something
     }
     else
     {
        //// do something
     }
0

2 Answers 2

5

Go to

File -> Settings -> Editor -> Code Style -> Java

enter image description here

  • Go to Wrapping and Braces tab.
  • under Braces placement, there's a drop-down called Others, change it to Next Line. (by default it is End of line). This will change bracer placement for all the places other than class and method declaration.
  • If you want class and method declarations also to appear in that style, change 2 previous drop-downs in Braces placement section(In class declaration, In method declaration) to Next Line also.
Sign up to request clarification or add additional context in comments.

Comments

0

How to configure code style for a language:

https://www.jetbrains.com/help/idea/2016.2/configuring-code-style.html

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.