| Author |
a friendly class with public constructor and methods
|
Laudney Ren
Ranch Hand
Joined: Jan 06, 2002
Posts: 111
|
|
I'm just wondering the effects of a modifer of a class. If the class itself is friendly or package private, can its methods, constructors and fields be declared pubic? If so, can classes outside the package invode those methods and constructors or access the fields?? What's the effect of the modifier of a class?
|
" Veni, vidi, vici "<br />" I came, I saw, I conquered "
|
 |
Junilu Lacar
Bartender
Joined: Feb 26, 2001
Posts: 4115
|
|
Moving this to Java in General (Beginner) Junilu
|
 |
John Wetherbie
Rancher
Joined: Apr 05, 2000
Posts: 1441
|
|
|
A class declared without an access modifier ("friendly" or "package" access) is only visible to other classes/interfaces in the same package. Making the methods public does not change this. So, no, classes outside the package cannot invoke the methods of this class.
|
The only reason for time is so that everything doesn't happen all at once.
- Buckaroo Banzai
|
 |
 |
|
|
subject: a friendly class with public constructor and methods
|
|
|