Modifier Keyword order in Java

access-modifiers, coding-style, java, syntax

Solution

In theory it does not matter if you say public static final or final static public, but if you follow the usual convention, other people will able to read your code more easily. Here is the preferred order:

[ public | protected | private ]

static

abstract

synchronized

[ transient | volatile ]

final

native

strictfp

[ int | long | String | class | enum | interface etc. ]

Problem

Every time I write a method in Java with more keywords than `public void`, every time I write it another way. Sometimes "`static public void`" sometimes "`public static void`" etc. What is the best order (best practices) for these keywords? [`abstract/static`] [`final`] [`synchronized`] [`public/private/protected`] [`result_type`]?

Original source

Related problems