+ Start a Discussion

Can anyone explain the purpose of util class with example?

Pradeep SinghPradeep Singh
Hi Karuna,
Util classes are classes that contain reusable code. So here you don't need to write a piece of code again and again. The piece of code that needs to be used in many places is placed in a class instead of writing it everytime we need that logic and we call that class a util class.
Hi Karuna,

Mark as best answer, If it resloves !!
Util class is used to store test data for you organization, it is helps as reusbale code 
for example you are trying to write a mutiple test classes you can use util class and store you data in util class and call that util class in you test class
it reduces time and code reusablity helps you .
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_testing_utility_classes.htm (http://​https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_testing_utility_classes.htm)

Mark as resloved if it helps :) :)
Bhanu Prakash
visit ForceLearn.com  (https://www.forcelearn.com)
Thanks Pradeep and Bhanu