Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why not a private no args constructor?

Looking at the ArrayUtils class from apache commons, the doc says :

ArrayUtils() 

ArrayUtils instances should NOT be constructed in standard programming.

I was looking at the source code of this class, and I saw they made the constructor public :

public ArrayUtils() {
   super();
}

Since all the methods/fields of the class are static, I understand that it makes no sense to create an instance of this class.

So why don't they made the constructor private like in the Math class to avoid creation of new instances?

like image 511
user2336315 Avatar asked Jan 18 '14 18:01

user2336315


1 Answers

The documentation says:

This constructor is public to permit tools that require a JavaBean instance to operate.

like image 54
Neeraj Krishna Avatar answered Sep 23 '22 05:09

Neeraj Krishna