my dog learned polymorphism*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Confused???  w/ Sample Code 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 "Confused???  w/ Sample Code" Watch "Confused???  w/ Sample Code" New topic
Author

Confused??? w/ Sample Code

Ray Marsh
Ranch Hand

Joined: Jan 12, 2000
Posts: 458
Please tell me if I'm correct in thinking there's something wrong with this example. I found in the "Complete Java 2 Certification Guide"
Button btn;
btn = new Button("Pink");
changer(btn);
System.out.println(btn.getLabel());
public void changer(Button replaceMe) {
changeMe.setLabel("Blue");
}
Shouldn't changeMe and replaceMe be the same name?
Thanks
[This message has been edited by Ray Marsh (edited April 28, 2001).]


Anxiety does not empty tomorrow of its sorrows, but only empties today of its strength. – Charles Spurgeon
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
You should report that error.
Hopefully, the publisher will be able to fix that in the next printing.
Ray Marsh
Ranch Hand

Joined: Jan 12, 2000
Posts: 458

Thanks.
Will do, it confused me at first. I thought I was missing something, but the longer I looked at it the more I became convinced it was a typo. One of the variable names was used in a previous example.
 
Don't get me started about those stupid light bulbs.
 
subject: Confused??? w/ Sample Code
 
Similar Threads
Argument Passing question
Object refrences
argument passing
what is the difference?????
Can someone talk about the reference?