Method name interchange - public abstract or abstract public

前端 未结 5 1139
故里飘歌
故里飘歌 2020-12-20 12:12

I recently came across the following methods. I tried googling and did an example to see the difference by defining the methods as follows; both seems to be the same. But, i

5条回答
  •  Happy的楠姐
    2020-12-20 12:56

    Both code is same and compiler will convert it to same byte code if you decompile the code. However it is general practice (not rule of thumb) to begin code with access specifier rather than other keywords.

    public abstract void methodName();
    abstract public void methodName();
    

    compiler converts both methods to below code

    public abstract void methodName();
    

提交回复
热议问题