Article View: borland.public.jbuilder.java.language
Article #19199Re: Sharing Values
From: Conrad Hoesle-Kienzlen
Date: Tue, 24 Feb 1998 00:00
Date: Tue, 24 Feb 1998 00:00
31 lines
1218 bytes
1218 bytes
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:
<34F3232E.74E0F9F@csi.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<34F2F2B8.4E352395@together.net>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,be10d319c9a31c3e X-Google-Attributes: gidf74b3,public From: Conrad Hoesle-Kienzlen <Conrad_Hoesle@csi.com> Subject: Re: Sharing Values Date: 1998/02/24 Message-ID: <34F3232E.74E0F9F@csi.com> X-Deja-AN: 328267870 Content-Transfer-Encoding: 7bit References: <34F2F2B8.4E352395@together.net> Content-Type: text/plain; charset=us-ascii Organization: CHK IT-Consulting Mime-Version: 1.0 Newsgroups: borland.public.jbuilder.java.language