bios
bios

Reputation: 169

How to format code like C# style for Java in Intellij?

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
     }

Upvotes: 3

Views: 2003

Answers (2)

Supun Wijerathne
Supun Wijerathne

Reputation: 12938

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.

Upvotes: 5

Dsenese1
Dsenese1

Reputation: 1156

How to configure code style for a language:

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

Upvotes: 0

Related Questions