I\'m currently reading about Java best practices and I found that according to this book we must Favor static classes over nonstatic. I\'ve remembered that in C# be
Advice given by JoshuaBloch also applies for c# and advice given for c# also applies for java(upto an extent as they talk about static classes).
Why use static members?
null
(which is a micro optimization) as opposed to instance methods(which uses callvirt opcode). I believe similar thing will be there in java also.this
reference to all the methods hidden.If you are used to Resharper productivity tool for visual studio, It will give the same advice as JoshuaBloch given for java, in c# saying that Method can be made static which is justified in the given link.
Why not use static members?
So, both advices are good if you understand them and they apply for both the languages. Use them when they are appropriate and avoid them when they are not.
member class
and enclosing
, which is Java-specific feature (how it is implemented).