Questions tagged [sun-coding-conventions]

Sun Coding Conventions refers to the original coding standards for the Java programming language

Sun Microsytems(now part of Oracle) originally published the document under the name "Java Code Conventions" in 1997. It was subsequently revised under the name "Code Conventions for the Java Programming Language".

References

7 questions
7
votes
2 answers

java style for long throws exception list

What's the Java style for formatting a long throws list? Let's say I have this: public void some() throws IOException, ClassNotFoundException, NoSuchMethodException,InvocationTargetException, IllegalAccessException { } Should it be: public…
OscarRyz
  • 196,001
  • 113
  • 385
  • 569
5
votes
3 answers

Coding conventions for number literal suffix?

I did some googleling, but was unable to find a solution to my question. Are there generally accepted java coding conventions according to double and float declaration? What syntax is recommended by those guidelines? Double d = 1d; …
L.Butz
  • 2,466
  • 25
  • 44
4
votes
2 answers

Confusing naming convention for package in scala

I'm learning to scala and I'm seeing official document for style guide for scala. But I am confused why same expression is encourage and discourage at the same time. According to scala style guide first package coolness is wrong but the second…
Hyun
  • 566
  • 1
  • 3
  • 13
4
votes
2 answers

Java Coding Conventions: Getters & Setters

Why is it convention to place getters and setters after constructors within classes? I would rather see them placed immediately after class fields, before the constructors, in order to see which of the private fields are accessible via getter &…
Tom Tresansky
  • 19,364
  • 17
  • 93
  • 129
2
votes
1 answer

Anonymous class instance placement

Where do you place instance of anonymous class? public class MyClass { // Variables private Api api; // Functions public void callApi() { api.get(<...>, responseListener) } // Where to put that? Top of the file,…
mbmc
  • 5,024
  • 5
  • 25
  • 53
1
vote
2 answers

CheckStyle rules for Java Code Conventions from 1997

Is there a CheckStyle rule file that checks against the Java Code Conventions from September 12, 1997?
deamon
  • 89,107
  • 111
  • 320
  • 448
1
vote
2 answers

How to name final List variable in java?

Should I name a final List as private final List MALE_SWIMMER_LIST=new ArrayList<>(); or private final List maleSwimmerList=new ArrayList<>(); or private final List maleSwimmers=new ArrayList<>(); …
chamathabeysinghe
  • 858
  • 2
  • 13
  • 34