Do we have to do new on static classes… here is a solution to the problem.
Do we have to do new on static classes
While browsing the documentation, I read that some ViewHolder is a static class, but does it need to create a new one on the static class?
Did they do new in that example? But according to the concept new shouldn’t be done on a static class, right?
Solution
You can only construct a class in four ways:
- Use “new”
- Use Class.newInstance
- Use a method/factory that uses new internally to create a new instance
- If supported, use object.clone
1 and 3 are by far the most commonly used