This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.

The .lang classes for J2ME is a smaller subset of the full J2SE. The Math class is one of them, since MIDP 1.0 did not have support for floating points, methods of the Math classes were removed. random() was one such method. I think it might be back in for MIDP 2.0, but I don't have the API completely memorized.

Nope, just checked Mr. Knudsen's book and there is no random method in the Math class for J2ME. Sorry.

Mark, I think WTK 2.1 supports MIDP 2.0 and the original poster is using WTK 2.1... So it should be able to compile... Or is he choosing MIDP 1.0 as its profile, when he created the project?

Co-author of SCMAD Exam Guide, Author of JMADPlus SCJP1.2, CCNA, SCWCD1.4, SCBCD1.3, SCMAD1.0, SCJA1.0, SCJP6.0