wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Default access 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 "Default access" Watch "Default access" New topic
Author

Default access

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
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

Joined: Jun 03, 2000
Posts: 5040

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

Take a Minute, Donate an Hour, Change a Life
http://www.ashanet.org/workanhour/2006/?r=Javaranch_ML&a=81
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
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

Joined: Jun 03, 2000
Posts: 5040

IMO, it is.
regds
- satya
maha anna
Ranch Hand

Joined: Jan 31, 2000
Posts: 1467
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

Joined: Nov 22, 2008
Posts: 18944
Thanks! maha. Its clear now.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Default access