Originally posted by Zahid, Butt:
" A class in which all the members are declared private cannot be declared public. "
Can someone elaborate on this PLEASE ??? Maybe some code examples ??
Thanks in advance.
6.4.2 The Members of a Class Type
The members of a class type (�8.2) are classes (�8.5, �9.5),
interfaces (�8.5, �9.5), fields (�8.3, �9.3, �10.7), and methods
(�8.4, �9.4). Members are either declared in the type, or
inherited because they are accessible members of a superclass or superinterface which are neither private nor hidden nor overridden (�8.4.6).
Jane Griscti
SCJP, Co-author Mike Meyers' Java 2 Certification Passport
Members of a class that are declared private are not inherited by subclasses of that class. Only members of a class that are declared protected or public are inherited by subclasses declared in a package other than the one in which the class is declared.
"JavaRanch, where the deer and the Certified play" - David O'Meara
"JavaRanch, where the deer and the Certified play" - David O'Meara
Tony Alicea
Senior Java Web Application Developer, SCPJ2, SCWCD
Jane Griscti
SCJP, Co-author Mike Meyers' Java 2 Certification Passport
ANaveenS
"JavaRanch, where the deer and the Certified play" - David O'Meara
Jane Griscti
SCJP, Co-author Mike Meyers' Java 2 Certification Passport
Jane Griscti
SCJP, Co-author Mike Meyers' Java 2 Certification Passport
I don't always make ads but when I do they're tiny
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
|