How to create a singleton class in multi threaded environment ?
AnswerBot
1y
To create a singleton class in a multi-threaded environment, we can use double-checked locking or synchronized block.
Use double-checked locking to minimize the use of synchronization and improve perfo...read more
20cse211 subhamkumarpadhy
1y
Create the private constructor to avoid any new object creation with new operator.
Declare a private static instance of the same class.
Provide a public static method that will return the singleton clas...read more
Help your peers!
Add answer anonymously...
Top Copart Java Developer Intern interview questions & answers
Popular interview questions of Java Developer Intern
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app