in Education by

How can you create Singleton class in java?

1 Answer

0 votes
by
How can you create Singleton class in java?
It is two step process. First, make the constructor private so that new operator cannot be used to instantiate the class. Return an object of the object if not null otherwise create the object and return the same via a method.

Related questions

0 votes
    Can we create a clone of a singleton object?...
asked Nov 7, 2020 in Education by Editorial Staff
0 votes
    How to create an immutable class in JAVA?...
asked May 19, 2021 in Technology by JackTerrance
0 votes
    What is singleton class in android?...
asked Jan 14, 2021 in Technology by JackTerrance
0 votes
    What are the difference between a static class and a singleton class?...
asked Nov 7, 2020 in Education by Editorial Staff
0 votes
    I am wanting to find the distance between two different points. This I know can be accomplished with the ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 19, 2022 in Education by JackTerrance
0 votes
    How can you create a node for comment in JavaScript? (a) comment() (b) createComment() (c) comm( ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Oct 23, 2021 in Education by JackTerrance
0 votes
    What are the different types of object relations in salesforce? How can you create them?...
asked Nov 11, 2020 in Technology by JackTerrance
0 votes
    how can you personalize your computer and create files and folders Select the correct answer from above options...
asked Dec 29, 2021 in Education by JackTerrance
0 votes
    how can you create a link to your emali address using (A) tag Select the correct answer from above options...
asked Dec 15, 2021 in Education by JackTerrance
0 votes
    How can you create many to many relationships under salesforce? (1)Creating direct many to many relationships (2) ... (4)Not possible to create many relationships in salesforce...
asked Aug 26, 2021 in Technology by JackTerrance
0 votes
    How can you create many to many relationships under salesforce? 1. Using a piece of code to relate both ... in salesforce 4. Creating direct many to many relationships...
asked Jun 27, 2021 in Technology by JackTerrance
0 votes
    How can you create Fixed Layout with Bootstrap?...
asked Apr 4, 2021 in Education by JackTerrance
0 votes
    How can you create a web page using Bootstrap?...
asked Apr 4, 2021 in Education by JackTerrance
0 votes
    How can you create a login?...
asked Nov 9, 2020 in Technology by Editorial Staff
...