Question

QUESTIONS TO ANSWER: In your own words what is the difference between pass by reference and...

QUESTIONS TO ANSWER:

In your own words what is the difference between pass by reference and pass by value?

What is a privacy leak in Java?

Why could it be important to prevent privacy leaks, besides just the obvious answer of unintentionally sharing data?

Homework Answers

Answer #1

Difference between pass by reference and pass by value :

When a function is called, the arguments in a function can be passed by value or passed by reference. Pass by value means that a copy of the actual parameter’s value is made in memory, i.e. the caller and callee have two independent variables with the same value. If the callee modifies the parameter value, the effect is not visible to the caller.

Pass by reference (also called pass by address) means to pass the reference of an argument in the calling function to the corresponding formal parameter of the called function so that a copy of the address of the actual parameter is made in memory, i.e. the caller and the callee use the same variable for the parameter. If the callee modifies the parameter variable, the effect is visible to the caller’s variable.

privacy leak :

When a class has class type instance variables and returns a reference to them allowing an outside user to modify them.

How to prevent privacy leak:

Make all instance variables primitive types

Only return clones of any object that you return

Only use instance variables that have no mutator methods

Please do give a like thanks...!!

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Use the reference, Theory at a Glance (2005) to answer questions 1-2 Explain in your own...
Use the reference, Theory at a Glance (2005) to answer questions 1-2 Explain in your own words, “what is theory”? Explain in your own words, what is the Health Belief Model
PLEASE use your own words because I have posted this questions before and the answer was...
PLEASE use your own words because I have posted this questions before and the answer was just coping. #Section 1 instructions: #Answer the following two questions in your own words. #Save your answers to the provided objects as strings. #(i.e., aS1Q1 <- "my answer") #Question 1.1 #What is a program? aS1Q1 <- #Question 1.2 #what are three reasons why quantitative researchers program? aS1Q2 <-
Using your own words, what is the difference between unethical and unprofessional?
Using your own words, what is the difference between unethical and unprofessional?
These questions have to do with Quickbooks please answer in your own words. 6. What financial...
These questions have to do with Quickbooks please answer in your own words. 6. What financial reports should you prepare at the end of the year in order to prepare for tax preparation or other types of financial reporting? 7. What is the difference between a Custom Summary Report and a Custom Transaction Detail Report?
Explain the difference between monetary and nonmonetary assets and liabilities. Please answer in your own words....
Explain the difference between monetary and nonmonetary assets and liabilities. Please answer in your own words. Do not use outside resources.
In your own words, explain the difference between REF and RREF. What are the advantages/disadvantages of...
In your own words, explain the difference between REF and RREF. What are the advantages/disadvantages of each, Include an example of each. (will rate if the answer is original and not copied)
Describe in your own words what the difference is, as it applies to this case, between...
Describe in your own words what the difference is, as it applies to this case, between a backplot and verification. Use the pocket and include screen clips to describe the differences.
In your OWN words, explain the difference between “crime” and “deviance.”
In your OWN words, explain the difference between “crime” and “deviance.”
In your own words, describe the difference between A Priori and A Posteriori probability
In your own words, describe the difference between A Priori and A Posteriori probability
In your own words, explain the difference between a binding and persuasive precedent. Would the District...
In your own words, explain the difference between a binding and persuasive precedent. Would the District Court WA(Australia) be bound to decisions made by the Supreme Court NSW(Australia)? Why or why not?
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT