Java Command list?Archives Forums/General Discussion/Java Command list?
| Been taking Gr12 Computer Science in high school recently, and apparently they teach Java for the course, anyhow, like most things programming related, I get stuck quickly when I cant figure out how to do something specific in a language that would appear simple.|
Anyhow, case in point, anyone know of any good command-lists with examples for the language kind of like the format the B3d docs have? Been stuck for awhile on how to convert an integer to a string (the commands the books we were supplied with just throw errors =\, the command in question being "toString"), and I cant find diddly on the language via Google, seems there's alot more to the language then I expected, most results turning up things nowhere relatively near what I require.
Though I must say it is interesting to program in something that uses a C-style syntax, but is easier to setup an app and "get" into it. (imo)
| This should take care of your needs, assuming you are using version 1.5.0:|
Been stuck for awhile on how to convert an integer to a string (the commands the books we were supplied with just throw errors =\, the command in question being "toString")The toString() method only works on an object, so you'd have to have an Integer object, rather than an int.
Anyway, if you have an int, the easiest way is with string concatenation ie. myString = "" + myInt; If you need to use objects, it's myString = new Integer(myInt).toString();
Both have the same result. To convert back to an Integer or int, use myInt = Integer.ParseInt(myString).
Thanks for the link, never knew there were THAT many commands in the language.
That worked a treat, thanks.
| Yeah the complexity of Java fried my brain at first, but now its simplicity has made it easier to use. It's a "fun" language to program in, though not as fun as Blitz of course. |
|Blitz BASIC Founders Fund|