Thread:Pecoes/@comment-4674838-20121012013714/@comment-4674838-20121017013221

Prints 1 apple, just like your example above

Warning: Just because you've protected the variable itself against reassignment doesn't mean you're entirely safe.
 * 1) Variables don't store objects, they store references to objects
 * 2) References are passed by value (just like in Java :), but since they point to the same object, the reference itself can still be used to change that object's state:

Prints 42 apples