import java.awt.Graphics;
public class test1 extends java.applet.Applet {
//@Override
private String str;
private String str2;
public test1()
{
str = "come on";
str2 = " my friend";
}
public void init()
{
str.concat(str2);
}
public void paint(Graphics g) {
g.drawString("Hello from java!", 60, 30);
g.drawString(str, 100, 100);
}
}
How come str should be "come on my friend" instead of just "come on"? but
the applet just displayed "come on" without "my friend", so what happened?
Thanks
Jack
Andrew Thompson - 02 Oct 2006 10:11 GMT
....
> public void init()
> {
> str.concat(str2);
This is 'throwing away the result', try instead..
str = str.concat(str2);
...
Andrew T.
Jacky Luk - 02 Oct 2006 10:20 GMT
perfect fit! thanks
Jack
"Andrew Thompson" <andrewthommo@gmail.com>
???????:1159780274.283238.320060@i42g2000cwa.googlegroups.com...
> ....
>> public void init()
[quoted text clipped - 6 lines]
>
> Andrew T.