what is private constructor?what are the uses of writing
private constructor in our program?
Answer Posted / nandhakumar
We use private constructor in singleton class:it ve only one
instance,in this case we generally used to ve one static
method (getInstance()).While we cal this method first time
it use private constructor to create instance.next time this
method returns the existin instance..
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Is there any sort function in java?
Why java uses the concept of the string literal?
What comes to mind when someone mentions a shallow copy in java?
Is hashset sorted in java?
What is the difference between comparison done by equals method and == operator?
What are thread safe functions?
1.IN CASE OF DYNAMIC METHOD DISPATCH WHY WE USE REFERENCE VARIABLE,WE CAN USE THE DIFFERENT DEFINED OBJECT DIRECTLY TO ACCESS THE DATA MEMBER AND MEMBER FUNCTION OF THAT RESPECTIVE CLASS?WHAT IS THE MAIN FUNCTION OF "REFERENCE VARIABLE" HERE?
What are different access specifiers in java? Explain
What are sets in java?
Give the hierarchy of inputstream and outputstream classes.
What is scope & storage allocation of static, local and register variables? Explain with an example.
What is a programming object?
What is the length of a string?
Is set sorted in java?
How do you use parseint in java?