If I pass a map over to a class I’ve made, if that class then modifies the map, would it change the map in the main method that passed it originally?
Does the second instance point to the same map?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes, the caller will see the changes that the callee makes.
There is no second instance (unless you explicitly make a copy of the map). What you have is two references to the same instance.