This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes A small doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "A small doubt" Watch "A small doubt" New topic

A small doubt

devika cha

Joined: Dec 17, 2003
Posts: 23
What is the default access specifier for a class?

Joined: Apr 12, 2000
Posts: 16
the default access specifier is "friendly"
Ajay Kumar
Ranch Hand

Joined: Apr 28, 2000
Posts: 87
Since "friendly" is not a java keyword, I would say that the default access specifier is "package". I would like to see maha anna's word on it.

Regds<BR>Ajay Kumar
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
What is the default access specifier for a class?
There is no no default access specifier ie if you want the class to have default access, then while defining the class, do not precede the class with any(private, protected and public) access modifier.
class Test{}// This class has default access
If the class is having a default access, the class's default feature is accessible to all the classes in the same package but not accessible to classes in the different package, even the subclass in different package cannot access the default feature.
Hope this helps!
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944

....and such classes are known as "friendly" classes
or "package" access classes (as mentioned in the previous
posts). These words are only for refering to the class
by the user community.
As mentioned they are NOT java keywords.
Summing up all the above posts ...

- satya
I agree. Here's the link:
subject: A small doubt
It's not a secret anymore!