Activity › Forums › Salesforce® Discussions › What is utility class in Salesforce?
-
What is utility class in Salesforce?
Posted by madhulika shah on July 17, 2018 at 11:31 AMWhat is utility class in Salesforce?
Parul replied 7 years, 7 months ago 4 Members · 3 Replies -
3 Replies
-
hello madhulika,
those methods which are used frequently in code, we make a utility class of them and we can reuse this method whenever we required it.
- [adinserter block='9']
-
Hi,
This class contain reusable codes, so that we need not to rewrite it again and again, we just call the method from that class into other as depending our logic.
Hope this helps.
-
Hi
The purpose of a utility class is to serve as a single one-stop-shop for reusable pieces of code. Basically any variable, method, inner class and whatever it might be that is used multiple times across multiple other classes within the project, can reside into a single (or multiple) utility class(es), which helps writing more elegant and structured code, as well as makes the code easier to maintain.
Thanks
Log In to reply.