File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Default access

 
Anonymous
Ranch Hand
Posts: 18944
  • 0
  • send pies
  • Quote
  • Report post to moderator
Hi,
Anyone pl. explain the meaning of the foll. statement.
Fellow package members should get accessed , not granted
to classes outside the package.
Thanks!
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

not sure what you don't understand in that stmt....
to me it looks like one of the ways you can describe
the default/friendly/package access modifier.
default access means access in the same package and
no access to classes outside the package.
or Am I missing something ?
regds.
- satya
 
Anonymous
Ranch Hand
Posts: 18944
  • 0
  • send pies
  • Quote
  • Report post to moderator
I am sorry for not being clear .Actually the statement
is regarding default class given in RHE.I couldnt get
what it meant.It meant that the other package members
must also get access to other package classes.But,
My doubt is REGARDING the grant word.what does it mean???
what is the difference between access and grant?If
access is given for the classes to access other package
members ,is not equivalent to granting the class???
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

IMO, it is.
regds
- satya
 
maha anna
Ranch Hand
Posts: 1467
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
avn,
From RHE as you quoted,
Fellow package members should get accessed , not granted
to classes outside the package.

This means, the accessiblity of the class which has 'package'/default level access is given to the fellow package members and NOT GRANTED to outsiders. (members of other packages). Here the word 'GRANT' serves a suitable meaning. When we do something out of our wish we say , 'we grant so and so to .. so and so person', Isn't? That means the 'giving away' is not a default action. Which also means we should not take for granted that the action will happen. Simillarly here the fellow package members are GIVEN access and other package members are not given or NOT GRANTED access. The GRANTED stresses the point that the other package members are treated as outsiders and so we grand/don't grand permission to access.
Simillarly take the other access type 'protected'. Here we can say the fellow package members are GIVEN (not granted , because the fellow members are in the SAME CIRCLE as that of the 'protected' class) permission to access the class which has 'protected' access / the subclasses of this 'protected' class are GRANTED permission whereas all other classes except the subclasses in other packages are NOT GRANTED PERMISSION to access the 'protected' type class. Does this make sense avn ?.
regds
maha anna
 
Anonymous
Ranch Hand
Posts: 18944
  • 0
  • send pies
  • Quote
  • Report post to moderator
Thanks! maha. Its clear now.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic