This site requires JavaScript, please enable it in your browser!
Greenfoot back
-nic-
-nic- wrote ...

2012/10/4

How to convert a int to a string?

-nic- -nic-

2012/10/4

#
this is what ive got:
ti.mark();
        string=ti.millisElapsed();
and i get this error: found int but expected a string
Builderboy2005 Builderboy2005

2012/10/4

#
Just do
string = "" + ti.miillisElapsed();
Most things in hava have automatic string conversion, you just need to tell Java that you want to convert it to a string. By adding it onto the end of "", which is an empty string, it automatically converts it for you.
-nic- -nic-

2012/10/4

#
thanks a lot
You need to login to post a reply.