Hi Praveen
Oops...It still does not work  : (

StringBuffer retStr = new StringBuffer("");
int iret;
boolean isBot=false;
isBot = isBotHead(iret,retStr);
// I want get iret = 2000 & retStr = "FLYING" now
// but ...

protected boolean isBotHead(int iret,StringBuffer retStr){
  iret = 2000;
  retStr = new StringBuffer("FLYING");
  return true;
}

AidyZhang




----- Original Message -----
From: Praveen Kumar S . <[EMAIL PROTECTED]>
To: ZhangQi <[EMAIL PROTECTED]>
Sent: Wednesday, January 12, 2000 3:07 PM
Subject: RE: A VERY beginner's question


> Well...
>
> String is not mutable, so it will not reflect back, if it is changed in a
> function.
>
> try StringBuffer instead, and convert it back to string.
>
> Amit
>
> > -----Original Message-----
> > From: ZhangQi [SMTP:[EMAIL PROTECTED]]
> > Sent: Wednesday, January 12, 2000 12:30 PM
> > To: [EMAIL PROTECTED]
> > Subject: Re: A VERY beginner's question
> >
> > Hi Srikar,
> >
> > In C++ , I can use isBot(&retStr) to pass the address of retStr, I want to
> >
> > get the value of retStr , but it does not change after run the isBot()
> >
> > but in java I do not know how to pass the address of retStr into the
> > isBot()
> >
> > I have some mistake in my question codes, the correct one is in the below:
> >
> >
> > // ************************************************************
> > string retStr = new String("");
> > String Str1 = new String("<HTML>FLYING TO THE MOON</HTML>")
> > int iret = 0;
> > int flag;
> > flag = isBot(Str1,iret,retStr);
> > System.out.print(retStr); // print a empty str ??  : (
> >
> > Public boolean isBot(String Str1,int iret,String retStr)
> > {
> >     ......
> >     retStr = new String("abc");        or      retStr = "abc";
> >     iret = 100;
> >     return iret;
> > }
> > // ************************************************************
> >
> > I can not get the values "iret = 100" & "retStr = 'abc' "
> > and java does not support &iret &retStr
> >
> >
> >
> >
> >
> >
> > ----- Original Message -----
> > From: Srikar Reddy <[EMAIL PROTECTED]>
> > To: ZhangQi <[EMAIL PROTECTED]>
> > Sent: Wednesday, January 12, 2000 2:45 PM
> > Subject: RE: A VERY beginner's question
> >
> >
> > > iret = isBot(Str1,iret,retStr);
> > >
> > > isBot method will return an  integer value only.
> > > In the isBot method you are returning iret  only  so you will get 100
> > > if you use
> > > System.out.print(iret);
> > >
> > >
> > > Srikar Reddy
> > > Metamor Global Solutions, Delhi.
> > > * : 91-11-8-568210 To 216
> > >       Xtn.  122.
> > >
> > >
> > > -----Original Message-----
> > > From: ZhangQi [SMTP:[EMAIL PROTECTED]]
> > > Sent: Wednesday, January 12, 2000 11:56 AM
> > > To: [EMAIL PROTECTED]
> > > Subject: A VERY beginner's question
> > >
> > > Hi all,
> > >
> > > I have the following codes:
> > >
> > > // ************************************************************
> > > string retStr = new String("");
> > > String Str1 = new String("<HTML>FLYING TO THE MOON</HTML>")
> > > int iret = 0;
> > > iret = isBot(Str1,iret,retStr);
> > > System.out.print(retStr);
> > >
> > > Public int isBot(String Str1,int iret,String retStr)
> > > {
> > >     ......
> > >     retStr = new String("abc");        or      retStr = "abc";
> > >     iret = 100;
> > >     return iret;
> > > }
> > > // ************************************************************
> > >
> > > I can not get the values "iret = 100" & "retStr = 'abc' "
> > > and java does not support &iret &retStr
> > > What can I do ?
> > > Pls help me ...
> > >
> > > AidyZhang 2k/1/12
> > >
> > >
> > ==========================================================================
> > =
> > > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> > > JSP-INTEREST".
> > > FAQs on JSP can be found at:
> > >  http://java.sun.com/products/jsp/faq.html
> > >  http://www.esperanto.org.nz/jsp/jspfaq.html
> >
> > ==========================================================================
> > =
> > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> > JSP-INTEREST".
> > FAQs on JSP can be found at:
> >  http://java.sun.com/products/jsp/faq.html
> >  http://www.esperanto.org.nz/jsp/jspfaq.html

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to