Issue
I have been working on android for some time and i wondered today that :
Why do we make a Singleton
Class for Retrofit Client
?
What happens if we don't?
Solution
Singleton class is used for this, so that only one object can be created at a time so this helps us in memory management.
If you don't make a class singleton then multiple instances will be created and if you don't trash those objects even by mistake then it will hold a lot of memory which is not good.
Answered By - Karan Mehta
Answer Checked By - Katrina (JavaFixing Volunteer)