File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Private Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Private" Watch "Private" New topic


Brian, Cavanagh
Ranch Hand

Joined: Oct 30, 2000
Posts: 70
Hi all,
When can a class be declared private?
Randall Twede
Ranch Hand

Joined: Oct 21, 2000
Posts: 4351

when it is an inner class.

Visit my download page
Brian, Cavanagh
Ranch Hand

Joined: Oct 30, 2000
Posts: 70
of course!!!
Golam Newaz
Ranch Hand

Joined: Jan 08, 2001
Posts: 64
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:

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.
Golam Sayeed Newaz

I agree. Here's the link:
subject: Private
It's not a secret anymore!