Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it correct to use "final static" or "static final"? [duplicate]

Tags:

java

How to use final in static class? Which way is true ?

private final static class 

or

private static final class
like image 559
mstfdz Avatar asked Oct 16 '25 02:10

mstfdz


2 Answers

You can use any. No Problem. Nothing wrong and there is no order. as a standard we are using this as private static final class but again there is nothing wrong of using both.

like image 147
Lasitha Benaragama Avatar answered Oct 17 '25 14:10

Lasitha Benaragama


Either of them is fine. There is no real difference, although there is no such thing as static class in java.

Have a look at this post to know how to make a class static.

like image 21
anirudh Avatar answered Oct 17 '25 14:10

anirudh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!