suppose we have two object;obj1 and obj2
can we assign obj2 to one1;
and if yes; then after assigning suppose we delete obj2
then obj1 will retain obj2 value or not.

Answer Posted / mahesh kotekar

Very tricky question, perhaps i would like to answer this
one with small coding.
Employee e1 = new Employee('mahesh','Software');
Employee e2 = e1;
e1 = null;

console.writeline(e2.FirstName);
Answer: We can assign the reference of the object to other
object. since both e1 and e2 refers to the same memory
location for the empllyee object. If we change the e1 then
refernce to memory of e1 will get deleted but e2 stil refers
to the same memory location Certainly it will work. and
retain the value.

Thanks And Regards
Mahesh KOtekar

Is This Answer Correct ?    7 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Just by seeing the signature of the bean how can you specify whether it is a stateful or stateless session bean?

557


How many types of sessions are there in asp net?

526


State differences between MVC and WebAPI

611


What is the usie of activex control in .net?

562


Explain security types in asp.net?

547






What is meant by web application?

550


How do I know asp.net mvc version? : Asp.Net MVC

508


Define page fragment caching?

528


Is it right that ASP.NET Web API has replaced WCF?

512


Where is session data stored in asp net?

517


Does web services support data reader like pom project?

536


What is owin authentication?

520


What is dynamic web page with example?

530


In which event are the controls fully loaded?

568


What is the difference between cache and cookies?

520