MadhuV sudan

Greenhorn
+ Follow
since May 30, 2004
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by MadhuV sudan

hey jef..thanks for the reply..it is crystal clear now..
hi jef..thanks for u'r reply..
What I wanted to know was the difference between passing the reference and the passing the object as a whole..In both the cases if we change the argument passed it is ultimately going to affect the object..
(Ex)..Assume..
public void modifyObject(Dog d) {
d.setColor("Brown");
}

What difference does it make if the argument "d" is a copy of the reference or is it a serializable object? Or is there really a difference?If we modify the attribute "color" of the object "Dog" in both the cases(local/remote method) the final object will be modified..right?

I had one more doubt..
Let us consider the same method both as local as well as remote..

public Dog modifyObject(Dog d) throws NotValidColorException {
d.setColor("Brown");
if (x)
throw new NotValidColorException("Invalid Color");
return d.
}

First let us assume this method is a local method..If the "NotValidColorException" exceptions gets thrown, the "Dog" object referenced by the client will have the color set to "Brown"..

If we assume the above as a remote one(i.e., present in bean implementation class) and the "NotValidColorException" exception is thrown the object "Dog" reference by the client will not hold the color as "Brown"..Why??
I am preparing for SCBCD certification using HeadFirst EJB. It was mentioned that if you pass an object to a remote method, the actual object gets passed instead of a copy of the reference. But I would like to know what is the difference between passing the entire object and passing the copy of the reference?