Tech Mahindra Interview Question

Write program for singleton pattern and explain?