Hi all, When can a class be declared private? Cheers, Brian
Randall Twede
Ranch Hand
Joined: Oct 21, 2000
Posts: 4089
posted
0
when it is an inner class.
SCJP
Brian, Cavanagh
Ranch Hand
Joined: Oct 30, 2000
Posts: 70
posted
0
of course!!!
Golam Newaz
Ranch Hand
Joined: Jan 08, 2001
Posts: 64
posted
0
Hi, I am giving a little more important information about private. First you have to know what is access modifier. There are four important access modifier:
private public protected package access
public : Anybody can create an instance of your class. In turn, if you use private modifier, no other class can instantiate your class as an object. Your class can still contain public class methods, and those methods can construct an object and return it, but no one else can. Thanks, Golam Sayeed Newaz