This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes oo concepts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "oo concepts" Watch "oo concepts" New topic

oo concepts

maggie karve
Ranch Hand

Joined: Dec 29, 2009
Posts: 187
W. Joe Smith
Ranch Hand

Joined: Feb 10, 2009
Posts: 710
I believe it has to do with this line:

Since you have a Derived object, whenever you are calling addValue() you are goign to call teh most specific version of that method, in this case being value += 20. Since it is being called twice (once in superclass constructor, once in subclass constructor) the value will be 40.

When I die, I want people to look at me and say "Yeah, he might have been crazy, but that was one zarkin frood that knew where his towel was."
It is sorta covered in the JavaRanch Style Guide.
subject: oo concepts