Is there a coding standard for Java?

后端 未结 4 906
小鲜肉
小鲜肉 2021-01-20 22:56

I can develop an application/project. But that is not in the correct coding standard. it takes large memory and others can not be understand it easily. What the General Stan

4条回答
  •  生来不讨喜
    2021-01-20 23:16

    There are many coding standards for Java. I.e.: OpenJDK (this is my preferred one) or Google ones.

    Unfortunately if you search Internet you will find the outdated Sun guidelines (Oracle still maintains that document online).

    It is wise to accommodate to platform coding standards the most you can. However they are a matter of style and thus, you can bend some rules to your (or your team) likings keeping them as a base.

    The most important things about having a coding standard are:

    1. All your code complies with it.
    2. It is clearly stated which are the rules, and they are easy to find in your code base (a good place would be the file README.*).

    In my case, my coding standards are something like: OpenJDK standard, except closing brackets in their own line.

提交回复
热议问题