views:

275

answers:

3

What is the standard when coding in Java, when do you use camel case when do you use underscores etc.

+5  A: 

See Sun's Code Conventions for the Java(TM) Programming Language.

Christoph
+15  A: 

You stick with the Java Code Conventions.

What exactly the standard is doesn't matter - what matters is that everyone follows it, and you should too.

Anon.
+9  A: 

ClassName

  • Renderer
  • HttpSession

methodName

  • applyTo()
  • run()

instanceVariable / localVariable

  • currentUser
  • threadList

CONSTANT_NAME

  • LOG
  • DEFAULT_CONTEXT

G (Generic Type Parameter)

  • T
  • E
Willi
Don't forget generic parameters.
Tom Hawtin - tackline
What is the standard for acronyms in camel case?e.g. getURL() vs. getUrl()
CD Sanchez
It's getUrl() or HttpSession, as shown in my post ;)
Willi
Thank you, I'm retarded :(
CD Sanchez