Originally posted by james gong:
A class which has all its constructors declared as private
1.Cannot be instantiated by any other class.
2.Cannot be extended.
3.Both i and ii.
4.has to be declared final.
key is ;2
but i cant pull out myself from ans1 and ans2,and I also cant make me clearly among the two ans.concern the case please say something .
Guoqiao Sun<br />SCJP2 SCWCD2<br />Creator of <a href="http://www.jiris.com/" target="_blank" rel="nofollow">www.jiris.com</a>, Java resource, mock exam, forum
Jane Griscti
SCJP, Co-author Mike Meyers' Java 2 Certification Passport
Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Originally posted by Thomas Paul:
It can't be instantiated by any other class. It can be instantiated by itself through a public method but instantiation implies the use of "new" and new can't be used if all the constructors are private.
It can't be extended because the extending class wouldn't be able to instantiate a copy of the parent class.
That's what I meant when I said that, "It can't be instantiated by any other class. It can be instantiated by itself through a public method..."Originally posted by Desai Sandeep:
Thomas,
You can use "new" keyword, even if the class has all privately defined Constructors.However, you need to use it in the class itself.
Please see the code that I have posted earlier in this thread.
Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Without involvement, there is no commitment. Mark it down, asterisk it, circle it, underline it.<BR>No involvement, no commitment.
Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Originally posted by james gong:
A class which has all its constructors declared as private
1.Cannot be instantiated by any other class.
2.Cannot be extended.
3.Both i and ii.
4.has to be declared final.
key is ;2
It looks like it's time for me to write you a reality check! Or maybe a tiny ad!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
|