🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Sharing Values

#19200
From: John Niesz
Date: Tue, 24 Feb 1998 00:00
38 lines
1522 bytes
Instead, if you want the second class to always have a copy, you could just
pass the string in as another parameter to the constructor and have the second
class have its own member variable.

John

Conrad Hoesle-Kienzlen wrote:

> Tucker,
> if those two classes are in the same package, then all you need is a public
> setter/getter method in the class that contains the string:
>
>   public string getMyString() {
>     return mystring;
>   }
>
>   public void setMyString(String s) {
>     mystring=s;
>   }
>
> If that class is called "Sup", then the other class would access it by:
>
>   Sup.setMyString("that ole string should go down well");
>
> or:
>   String needed = Sup.getMyString();
>
> ...Conrad
>
> Tucker Bradford wrote:
>
> > I have two classes in the same project. I have a String in one class
> > (Sup), and would like to pass the value of the string to the other class
> > how do I do this.
> > bez@together.net
> > Thanks
> > -Tucker
Technical Details
Message-ID: <34F32E50.75E6A2DC@worldnet.att.net>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <34F2F2B8.4E352395@together.net> <34F3232E.74E0F9F@csi.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,be10d319c9a31c3e
X-Google-Attributes: gidf74b3,public
From: John Niesz <sunrunner15@worldnet.att.net>
Subject: Re: Sharing Values
Date: 1998/02/24
Message-ID: <34F32E50.75E6A2DC@worldnet.att.net>
X-Deja-AN: 328276469
Content-Transfer-Encoding: 7bit
References: <34F2F2B8.4E352395@together.net> <34F3232E.74E0F9F@csi.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Organization: None
Newsgroups: borland.public.jbuilder.java.language