3.8. Passing objects and primitives to methods
[6.6] Determine the effect upon object references and primitive values when they are passed into methods that change the values.
In this section, you’ll learn the difference between passing object references and primitives to a method. You’ll determine the effect on object references and primitive values when they’re passed into methods that change the values.
Object references and primitives behave in a different manner when they’re passed to a method because of the differences in how these two data types are internally stored by Java. Let’s start with passing primitives to methods.
3.8.1. Passing primitives to methods
The value of a primitive data type is copied and passed to ...
Get OCA Java SE 8 Programmer I Certification Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.