Article View: borland.public.jbuilder.java.language
Article #8530Re: Simple question for gurus ;)
From: Stefan Adolfsson
Date: Mon, 19 Mar 2001 22:34
Date: Mon, 19 Mar 2001 22:34
51 lines
2122 bytes
2122 bytes
Use the integer as an object,,,
instead of:
int param ;
do:
Integer param;
then the integer will work as an object which is changed directly in
java and not copied.
example:
public void test(Integer param) { param.set(5);
}
public void example(){
Integer example_parameter = new Integer(0);
test( example_parameter );
System.out.println("parameter: " + example_parameter);
}
On Mon, 19 Mar 2001 21:29:30 +0100, "John Good"
<dumster@collector.org> wrote:
>
>I've got a strange problem with Java, it's probably a feature, but please
>point me to solving this.
>
>If I have something like:
>
>public void test(int param) { param = 5;
>}
>
>and practically want to set the param to 5 (I do not want to use return,
>please!), and when I call it from another method, like:
>
>public void example(){
> int example_parameter = 0;
> test( example_parameter );
> System.out.println("parameter: " + example_parameter);
>}
>
>I'll get the 0 as the output, and I want 5; how to assign a value a
>parameter? (pointers I miss you ;)
>I've checked some books on that, but as allways its not in it, because it's
>"too obvious"...
>
>plz help :)
>
>
Technical Details
Message-ID:
<3ab688c8.43123726@news.cs.umu.se>Path:
arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!logbridge.uoregon.edu!newsfeed.sunet.se!news01.sunet.se!news.umu.se!not-for-mailReferences:
<Z_tt6.19$xH3.1481@psinet-eu-nl>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,a90669a07786d662 X-Google-Attributes: gidf74b3,public X-Google-ArrivalTime: 2001-03-19 15:42:22 PST Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!logbridge.uoregon.edu!newsfeed.sunet.se!news01.sunet.se!news.umu.se!not-for-mail From: stefan.adolfsson@usa.net (Stefan Adolfsson) Newsgroups: borland.public.jbuilder.java.language Subject: Re: Simple question for gurus ;) Date: Mon, 19 Mar 2001 22:34:12 GMT Organization: News UmU SE Lines: 52 Message-ID: <3ab688c8.43123726@news.cs.umu.se> References: <Z_tt6.19$xH3.1481@psinet-eu-nl> NNTP-Posting-Host: flintv158.sn.umu.se X-Trace: hudsucker.umdac.umu.se 985041551 2621 130.239.145.212 (19 Mar 2001 22:39:11 GMT) X-Complaints-To: newsmaster@umu.se NNTP-Posting-Date: Mon, 19 Mar 2001 22:39:11 +0000 (UTC) X-Newsreader: Forte Free Agent 1.21/32.243