🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #7291

Re: can i change a int type Not Integer type argument in a function ?

#7291
From: John McGrath TeamB
Date: Sat, 30 Jun 2001 23:22
44 lines
2775 bytes
On Fri, 29 Jun 2001 09:03:41 -0400, "CLG" <lamont_gilbert @ 
rigidsoftware.com> wrote:

> Yea, primitives are passed in the only way possible, by value.
> I "assumed" that was understood.

I understand.  But someone reading the statement "Java always passes by 
reference" could easily misunderstand that.  I wanted to make sure that 
was clear.

> But object passing is not by value but by reference(the reference
> is like a primitive).  

Right.  Object references are passed by value, so objects are passed by 
reference.  The Java Language Specification describes this using the 
term "object reference" and says that object references are passed by 
value.  Either wording makes sense, and both mean the same thing.

> If it were by value, objects would be copied each time they were
> passed.  While the objects are not copied, the references are.
> That was my original point.  No matter what you are technically
> passing, its a copy (of a primitive).  either a copied primitive,
> or a copied reference.  But not a copied object.

Exactly.  I see a lot of people say that "all parameters in Java are 
passed by value", which is how it is described in the JLS.  But then 
people talk about passing objects as parameters (as opposed to object 
references), and others conclude that objects are passed by value.
The JLS approach is a very good one, as it is precise and it describes 
exactly what is going on.  The problem is that it is too easy to drop 
the word "reference".

So this will probably not be the last time you hear me say "object 
references are passed by value, so objects are passed by reference".  
:o)

-- 
Regards,

John McGrath [TeamB]

---------------------------------------------------
Before sending me e-mail, please read:
    http://www.JPMcGrath.net/newsgroups/e-mail.html
Technical Details
Message-ID: <MPG.15a80f34a8bb103798a30b@forums.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnews
References: <3b3b1371_2@dnews> <3b3b7ae2_1@dnews> <3b3bda1e_2@dnews> <3b3bf625$1_1@dnews> <MPG.15a5e2518d11ab0b98a2ff@forums.borland.com> <3b3c7db7_2@dnews>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,9b3cb30cd9a02399
X-Google-Attributes: gidf74b3,public
X-Google-ArrivalTime: 2001-06-30 16:27:53 PST
From: John McGrath  [TeamB] <ng-b@JPMcGrath.net>
Newsgroups: borland.public.jbuilder.java.language
Subject: Re: can i change a int type Not Integer type argument in a function ?
Date: Sat, 30 Jun 2001 19:22:23 -0400
Message-ID: <MPG.15a80f34a8bb103798a30b@forums.borland.com>
References: <3b3b1371_2@dnews> <3b3b7ae2_1@dnews> <3b3bda1e_2@dnews> <3b3bf625$1_1@dnews> <MPG.15a5e2518d11ab0b98a2ff@forums.borland.com> <3b3c7db7_2@dnews>
X-Newsreader: MicroPlanet Gravity v2.30
NNTP-Posting-Host: 209.92.40.60
X-Trace: dnews 993943342 209.92.40.60 (30 Jun 2001 16:22:22 -0700)
Lines: 44
X-Authenticated-User: jpmcgrath
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnews