• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

A small doubt

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is the default access specifier for a class?
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the default access specifier is "friendly"
 
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

....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
 
reply
    Bookmark Topic Watch Topic
  • New Topic