Search Interview Questions | More than 3000 questions in repository. There are more than 900 unanswered questions. Click here and help us by providing the answer. Have a video suggestion. Click Correct / Improve and please let us know. |
|
| |||||||||||
Core Java - Interview Questions and Answers for 'Util classe' - 2 question(s) found - Order By Rating | |||||||||||
| |||||||||||
Ans. Classes having only static methods in java is called util classes. As they don't have specific object state, they are basically intend to have shared code and state through static elements and methods. They save resources by sharing code. | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  util classes | |||||||||||
Try 1 Question(s) Test | |||||||||||
Related Questions | |||||||||||
In which cases , moving methods to utility class could be useful ? | |||||||||||
Name few Java util classes that were introduced with Java 7 ? | |||||||||||
Name few Java Util classes introduced with Java 8 ? | |||||||||||
| |||||||||||
Ans. It could be worthy to move a method to util class if the method needs to be shared, doesn't require polymorphic behavior and need not be overridden in special cases. Don't belong to one group through is-a relationship ( You can share through parent class method ) Don't implement a specific interface ( java 8 default methods ) Doesn't involve complex computing as you will be loosing the benefit of object state with just static method. Doesn't require polymorphic behavior as static methods don't participate in runtime polymorphism. | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  utility classes   util classes   static methods   application design   rare | |||||||||||
Related Questions | |||||||||||
Name few Java util classes that were introduced with Java 7 ? | |||||||||||
Name few Java Util classes introduced with Java 8 ? | |||||||||||
What are Util Classes ? What are its advantages ? | |||||||||||
| |||||||||||