wood burning stoves*
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
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "A small doubt" Watch "A small doubt" New topic
Author

A small doubt

devika cha
Greenhorn

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

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.
Ajay


Regds<BR>Ajay Kumar
Anonymous
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.
example:
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!
Anonymous
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 ...

Regds.
- satya
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: A small doubt