1 exception is for Java RMI. If your object is serializable
and does not implement java.rmi.Remote, it is passed by value.
>From: Kito Mann <[EMAIL PROTECTED]>
>Reply-To: "A mailing list for discussion about Sun Microsystem's Java
> Servlet API Technology." <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: Re: Parameters passed by reference
>Date: Wed, 15 Dec 1999 13:19:32 -0500
>
>Sushil,
>
>First, this question is way off topic.
>
>All Objecs in Java are passed by reference. Objects include Strings and
>Arrays, but not the primitive types: (ints, chars, longs, floats, etc.).
>
>So, for instance, in the following excerpt:
>
>public void test()
>{
> String s = "This is a string";
> myMethod(s);
> myMethod(s.clone());
> myMethod2(5);
>}
>
>public void myMethod(String s)
>{
> System.out.println(s);
>}
>
>public void myMethod2(int i)
>{
> System.out.println(i);
>}
>
>The first call to myMethod() is passing the variable "s" by reference; the
>second call is passing a _copy_ by reference, which is the closest you can
>get to passing an Object by value. The call to myMethod2() will _always_
>pass the variable by value, since the parameter is a primitive type and not
>an Object. You can't pass primitive types by reference, but you can use one
>of the wrapper Objects (Integer, Float, etc.) and pass those by reference.
>
>Kito D. Mann
>[EMAIL PROTECTED]
>
>
>
>
>[EMAIL PROTECTED]
>Wednesday December 15, 1999 09:27 AM
>
>Please respond to [EMAIL PROTECTED]
>To: [EMAIL PROTECTED]
>cc: (bcc: Kito Mann/PSG/Prudential)
>Subject: Parameters passed by reference
>
>
>
>
>Hi,
>
>I would like to know that how can we pass a variable by REFERENCE to a
>method within the same class.
>
>I have read that in order to pass by reference, we have to pass the object
>itself. But in my case I have to pass a variable say string to a method
>inside the same class.
>
>Thanks,
>
>Sushil
>Email: [EMAIL PROTECTED] (Personal)
> [EMAIL PROTECTED] (Official)
>
>___________________________________________________________________________
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff SERVLET-INTEREST".
>
>Archives: http://archives.java.sun.com/archives/servlet-interest.html
>Resources: http://java.sun.com/products/servlet/external-resources.html
>LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
>___________________________________________________________________________
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff SERVLET-INTEREST".
>
>Archives: http://archives.java.sun.com/archives/servlet-interest.html
>Resources: http://java.sun.com/products/servlet/external-resources.html
>LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html