Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Arrays

 
Lawrence Buensalida
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do I create and use arrays in j2me midp 2?
 
Svend Rost
Ranch Hand
Posts: 904
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As you do in J2SE (and J2EE for that matter).

Do you wish to make an array of anything specific, or was this just a general question ?

/Svend Rost
 
Lawrence Buensalida
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the tip, though I'm just starting to learn Java, what you said is going to be helpful. Actually, I'm planning on creating an array for a set of 5 randomized numbers and I don't know if J2ME is capable of doing it, moreover, I don't know how to create and implement.
 
Svend Rost
Ranch Hand
Posts: 904
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Yes, it's possible to make random numbers in J2ME.

It's pretty simple to make an array. The following is a small
program for J2SE, which prints the values in an integer array.

If you insert the above code in a file called arrayTest.java, and compile
it (write the following in the prompt: javac ArrayTest.java), and then
run it with: java ArrayTest


The following is a small article concerning Random numbers in Java.
If your new to computing, it might be "a bit to much".
More on Random numbers in J2ME

regards,

/Svend Rost
 
Lawrence Buensalida
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Alright! It worked in J2ME too. Thank you very much.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic