This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

constructor

 
Netty poestel
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dan chisholm:-
Question 2
Which of the following modifiers can be applied to a constructor?

a. private
b. abstract
c. final
d. volatile
e. native
f. None of the above.

Ans. in Dan = a private

K & B states = � Rules for Constructors
The following list summarizes the rules you�ll need to know for the exam (and to understand the rest of this section):
� Constructors can use any access modifier, including private.

Now where does this leave us wannabees .....?
 
Kathy Sierra
Cowgirl and Author
Rancher
Posts: 1589
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy!
There are *modifiers* and there are *access modifiers*. So, things like native, abstract, etc. are modifiers, but ACCESS modifiers are only
* private
* public
* protected

We say that there are four access LEVELS:
* private
* default
* protected
* public

(in order of restrictiveness)

but only THREE access MODIFIERS, since you can' use "default" as a modifier.

Does that help?

A lot of people at first find modifiers vs. access modifiers confusing since other modifiers can affect access in some ways (like "final"), but only the three modifers directly related to accessibility/visibility are considered "access" modifiers.

cheers,
Kathy
 
Netty poestel
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wow !
mail reply straight from 'THE' 'Cowgirl'.
Thanks Kathy, there remains no iota of an argument here.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic