What is your favorite java code formatting?

This post gave me an idea: Quick Question!:

What is your favorite type of formatting for java specifically? Personally I prefer google style formatting. Which you can find info here. So which do you prefer? If you don’t have a specific formatting style what formatting styles do you follow? What are some examples?

1 Like

Ah surprised this didn’t bring up in the search button. Weird. Or bring it up in your post is like this. My bad.

Its alright mate :wink:

1 Like

I don’t follow specific conventions when I program. I don’t know what you think of my conventions, but I like it. Constructive criticism is welcome.

If/else:

if(stuff="stuff!") {
    //Whatever... |:-]
} else {

}

Try/Catch:

int answer;
try {
    answer = 5/0;
} catch( ArithmeticException ignorable){
   ignorable.printStackTrace();
}

Empty Bodies:

public class TotallyUseless {}

Imports: (ex)

import org.spongepowered.someclass;
import org.spongepowered.otherclass;

import com.google.bitbite.exe; //Easter Egg!
import com.google.kill.mafia;

import java.io.IOException;
import java.lang.*; //Useless, but do I care?

import static java.lang.Math.*;
import static com.mojang.notch.Notch.getNotch; //note how I grouped all static imports together!

Really Long Code: (formatting messed up)

UselessyLong = LongCode.getCode().getLength().getUselessProperty().append(LongCode.getHairColor().getRGBColorCode()
    .toString().toUpperCase());

Should probably post in

as not to break up chat.