Exchange of method names - public annotation or abstract publication

I recently came across the following methods. I tried googling and made an example to see the difference, defining the methods as follows; both seem the same. But, I need to know if this is true?

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

Note: public and abstract interchangeable in the above methods.

+8
java
source share
4 answers

Same. Do not worry. Two similar declarations of the abstract method.

+7
source share

There is no difference in functionality, but no matter what you choose, it is best to stay consistent.

Saying, I almost never saw the abstract public that was used before. Thus, in terms of coding standards, public abstract is likely to be easier to recognize more people.

+12
source share

both are modifiers, you can use them in any order

+3
source share
 public abstract void methodName(); abstract public void methodName(); 

These two methods are similar to the same example:

 public static void main(String args[]); static public void main(String args[]); 

Thus, above two are the same. It is just our desire, how we want to write.

+2
source share

All Articles