Home
About Us
Contact Us
Bookmark
Saved Bookmarks
Current Affairs
General Knowledge
Chemical Engineering
UPSEE
BSNL
ISRO
BITSAT
Amazon
ORACLE
Verbal Ability
→
Java Constructor Tutorial
→
Java Constructor Interview Questions in Java Constructor Tutorial
→
Can We Declare Constructor As Private?
1.
Can We Declare Constructor As Private?
Answer»
Yes we can declare constructor as
PRIVATE
.
All four
ACCESS
modifiers are
ALLOWED
to constructor.
We should declare constructor as private for not to
ALLOW
user to create object from outside of our class.
BASICALLY
we will declare private constructor in Singleton design pattern.
Read more at Can we create private constructor in java
Show Answer
Discussion
No Comment Found
Post Comment
Related InterviewSolutions
If Class Has Explicit Constructor , Will It Has Default Constructor?
When Developer Must Provide Constructor Explicitly?
When Compiler Provides Default Constructor?
What Is Default Accessibility Modifier Of Default Constructor?
Why Compiler Given Constructor Is Called As Default Constructor?
Is Constructor Definition Is Mandatory In Class?
Can We Declare Constructor As Private?
Why Constructor Name Is Same As Class Name?
Why Return Type Is Not Allowed For Constructor?
How Compiler And Jvm Can Differentiate Constructor And Method Invocations Of Both Have Same Class Name?
Reply to Comment
×
Name
*
Email
*
Comment
*
Submit Reply
Your experience on this site will be improved by allowing cookies. Read
Cookie Policy
Reject
Allow cookies