This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
Iam referring to the question from K&B book(for version 1.4 - page 134) ..
1. What is the most restrictive access modifier that will allow members of one class to have access to members of another class in the same package? A. public B. abstract C. protected D. synchronized E. default access
and the given answer is E(page 141)
But as per the same book(127)
There are three access modifiers: public, protected, and private. There are four access levels: public, protected, default, and private.
As per the question its access modifier , but not acces level..in that case answer should be C..Some one correct me if i'm wrong
vignesh hariharan
Ranch Hand
Joined: Jun 23, 2005
Posts: 77
posted
0
ya even i got this same doubt.. but after seeing the answer as E then i thought that default has less scope than protected.. so i thought default is put up as the answer for that.. i am also not sure.. pls ranchers help us...
Regards,
vignesh
Sri Jad
Ranch Hand
Joined: Apr 25, 2005
Posts: 49
posted
0
i thought that default has less scope than protected..
default access level is definitely most restrictive(has less scope) than protective , but the question was most restrictive access modifier not most restrictive access level
vignesh hariharan
Ranch Hand
Joined: Jun 23, 2005
Posts: 77
posted
0
ya i guessed the answer since that default access has less scope than protected... and wat is that u have a deal with most restrictive access modifier and most restrictive access level ??? access modifiers gives the access levels right??? then wats the problem..??
wise owen
Ranch Hand
Joined: Feb 02, 2006
Posts: 2023
posted
0
1. What is the most restrictive access modifier that will allow members of one class to have access to members of another class in the same package?
The default (package protected) access modifier has the same visiblity as "protected" access modifier.
But, if the question ask for "class" access modifer for the top level class, then only "default" is right.
Sri Jad
Ranch Hand
Joined: Apr 25, 2005
Posts: 49
posted
0
1. What is the most restrictive access modifier that will allow members of one class to have access to members of another class in the same package?
For a given(or specified) package both protective access modifier and dafualt access level have the same scope .the difference comes only when other packages comes into picture.So our question is limited to the same package and as per the its access modifier not access level.
This is what i understood , still i may be wrong some where.
K Vidhyakar
Ranch Hand
Joined: Jul 10, 2005
Posts: 66
posted
0
hi, I had the same doubt . bcos default is not an access modifier. its the access level that we get when we dont include any modifiers. In the question i was asked about the most restrictive access modifiers and not access levels. So according to me the answer is protected. but i have attended many mock exam and they to say the same answer as default for similar question. I have appeared the exam and i got the same question and i have put the default as the answer . it was correct.i have secured 96 % in the exam.
So the anwer is Default. more suggestion are welcome.......
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.