|
Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
"If someone asks you to do something you don't know how to, don't tell I don't know, tell I can learn instead." - Myself
Originally posted by Graham Walsh:
Hi,
I've got the 1.4 book (darn, I should have got the 1.5!). Where can I find errata for the 1.4 book?
thanks much
GrahamO
Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
SCJP1.4, SCJP1.5
Originally posted by Kristian Perkins:
with the for each loop, you don't have direct access to the array references, you only have a copy of the references in the array so you cannot change the original Object references inside the array.
the previous code is equivalent to this:
The for each loop can't change the reference of the array elements, where as the old style for loop listed here can (because you have direct access to manipulate each reference in turn through myDogs[i] = new Dog()).
Hope that helps.
Kristian
Phil
Phil
Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
I'm not available, my BF's name is WORK.
Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
public class Horse extends Animal {
private Halter myHalter;//it should be private Halter myHalter = new Halter();
public void tie(LeadRope rope) {
myHalter.tie(rope); // Delegate tie behavior to the
// Halter object
}
}
public class Halter {
public void tie(LeadRope aRope) {
// Do the actual tie work here
}
}
Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
The glass is neither half full or half empty. It is too big. But this tiny ad is just right:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
|